Package co.cask.cdap.api.dataset.table

Examples of co.cask.cdap.api.dataset.table.Row


    }

    @Override
    public boolean nextKeyValue() throws InterruptedException {
      // call the underlying scanner, and depending on whether there it returns something, set current key and row.
      Row next = this.scanner.next();
      if (next == null) {
        this.key = null;
        this.row = null;
        return false;
      } else {
        this.key = next.getRow();
        this.row = next.getColumns();
        return true;
      }
    }
View Full Code Here


        if (result != null) {
          return result;
        }

        // If either no row has been scanned or already exhausted all columns from previous scan, find the next row.
        Row rowResult;
        while ((rowResult = scanner.next()) != null) {
          rowScanned++;
          byte[] rowKey = rowResult.getRow();

          // Decode context and metric from key
          int offset = 0;
          context = entityCodec.decode(MetricsEntityType.CONTEXT, rowKey, offset);
          // Always have a "." suffix for unique matching
          if (contextPrefix != null && !(context + ".").startsWith(contextPrefix)) {
            continue;
          }

          offset += entityCodec.getEncodedSize(MetricsEntityType.CONTEXT);
          metric = entityCodec.decode(MetricsEntityType.METRIC, rowKey, offset);
          // Always have a "." suffix for unique matching
          if (metricPrefix != null && !(metric + ".").startsWith(metricPrefix)) {
            continue;
          }

          offset += entityCodec.getEncodedSize(MetricsEntityType.METRIC);
          rid = entityCodec.decode(MetricsEntityType.RUN, rowKey, offset);
          if (runId != null && !runId.equals(rid)) {
            continue;
          }

          currentTag = rowResult.getColumns().entrySet().iterator();
          result = findNextResult();
          if (result != null) {
            return result;
          }
        }
View Full Code Here

  private Iterator<MetricsScanResult> createIterator() {
    return new AbstractIterator<MetricsScanResult>() {
      @Override
      protected MetricsScanResult computeNext() {
        Row rowResult;
        while ((rowResult = scanner.next()) != null) {
          rowScanned++;
          byte[] rowKey = rowResult.getRow();
          Map<byte[], byte[]> columnValue = rowResult.getColumns();

          // Decode context and metric from key
          int offset = 0;
          String context = entityCodec.decode(MetricsEntityType.CONTEXT, rowKey, offset);
          // Always have a "." suffix for unique matching
View Full Code Here

    try {
      scanner = timeSeriesTable.scan(null, null, null, null);

      // Loop through the scanner entries and collect rows to be deleted
      List<byte[]> rows = Lists.newArrayList();
      Row nextEntry;
      while ((nextEntry = scanner.next()) != null) {
        byte[] rowKey = nextEntry.getRow();

        // Decode timestamp
        int offset = entityCodec.getEncodedSize(MetricsEntityType.CONTEXT) +
          entityCodec.getEncodedSize(MetricsEntityType.METRIC) +
          entityCodec.getEncodedSize(MetricsEntityType.TAG);
View Full Code Here

        byte [] tillTimeBytes = Bytes.toBytes(tillTime);

        int deletedColumns = 0;
        Scanner scanner = ctx.get().scan(ROW_KEY_PREFIX, ROW_KEY_PREFIX_END);
        try {
          Row row;
          while ((row = scanner.next()) != null) {
            byte [] rowKey = row.getRow();
            byte [] maxCol = getMaxKey(row.getColumns());

            for (Map.Entry<byte[], byte[]> entry : row.getColumns().entrySet()) {
              byte [] colName = entry.getKey();
              if (LOG.isDebugEnabled()) {
                LOG.debug("Got file {} with start time {}", Bytes.toString(entry.getValue()),
                          Bytes.toLong(colName));
              }
View Full Code Here

TOP

Related Classes of co.cask.cdap.api.dataset.table.Row

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.