@Override public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException { this.output = output; this.context = context; try { KuduTable table = client.openTable(scanSpec.getTableName()); KuduScannerBuilder builder = client.newScannerBuilder(table); if (!isStarQuery()) { List<String> colNames = Lists.newArrayList(); for (SchemaPath p : this.getColumns()) { colNames.add(p.getAsUnescapedPath()); } builder.setProjectedColumnNames(colNames); } context.getStats().startWait(); try { scanner = builder .lowerBoundPartitionKeyRaw(scanSpec.getStartKey()) .exclusiveUpperBoundPartitionKeyRaw(scanSpec.getEndKey()) .build(); } finally { context.getStats().stopWait(); } } catch (Exception e) { throw new ExecutionSetupException(e); } }
@Override public int next() { int rowCount = 0; try { while (iterator == null || !iterator.hasNext()) { if (!scanner.hasMoreRows()) { iterator = null; return 0; } context.getStats().startWait(); try { iterator = scanner.nextRows(); } finally { context.getStats().stopWait(); } } for (; rowCount < TARGET_RECORD_COUNT && iterator.hasNext(); rowCount++) { addRowResult(iterator.next(), rowCount); } } catch (Exception ex) { throw new RuntimeException(ex); } for (ProjectedColumnInfo pci : projectedCols) { pci.vv.getMutator().setValueCount(rowCount); } return rowCount; }
private void updateStats() { operatorContext .getStats() .setLongStat(Metric.NUM_DICT_PAGE_LOADS, parquetReaderStats.numDictPageLoads.longValue()); operatorContext .getStats() .setLongStat(Metric.NUM_DATA_PAGE_lOADS, parquetReaderStats.numDataPageLoads.longValue()); operatorContext .getStats() .setLongStat( Metric.NUM_DATA_PAGES_DECODED, parquetReaderStats.numDataPagesDecoded.longValue()); operatorContext .getStats() .setLongStat( Metric.NUM_DICT_PAGES_DECOMPRESSED, parquetReaderStats.numDictPagesDecompressed.longValue()); operatorContext .getStats() .setLongStat( Metric.NUM_DATA_PAGES_DECOMPRESSED, parquetReaderStats.numDataPagesDecompressed.longValue()); operatorContext .getStats() .setLongStat( Metric.TOTAL_DICT_PAGE_READ_BYTES, parquetReaderStats.totalDictPageReadBytes.longValue()); operatorContext .getStats() .setLongStat( Metric.TOTAL_DATA_PAGE_READ_BYTES, parquetReaderStats.totalDataPageReadBytes.longValue()); operatorContext .getStats() .setLongStat( Metric.TOTAL_DICT_DECOMPRESSED_BYTES, parquetReaderStats.totalDictDecompressedBytes.longValue()); operatorContext .getStats() .setLongStat( Metric.TOTAL_DATA_DECOMPRESSED_BYTES, parquetReaderStats.totalDataDecompressedBytes.longValue()); operatorContext .getStats() .setLongStat(Metric.TIME_DICT_PAGE_LOADS, parquetReaderStats.timeDictPageLoads.longValue()); operatorContext .getStats() .setLongStat(Metric.TIME_DATA_PAGE_LOADS, parquetReaderStats.timeDataPageLoads.longValue()); operatorContext .getStats() .setLongStat( Metric.TIME_DATA_PAGE_DECODE, parquetReaderStats.timeDataPageDecode.longValue()); operatorContext .getStats() .setLongStat( Metric.TIME_DICT_PAGE_DECODE, parquetReaderStats.timeDictPageDecode.longValue()); operatorContext .getStats() .setLongStat( Metric.TIME_DICT_PAGES_DECOMPRESSED, parquetReaderStats.timeDictPagesDecompressed.longValue()); operatorContext .getStats() .setLongStat( Metric.TIME_DATA_PAGES_DECOMPRESSED, parquetReaderStats.timeDataPagesDecompressed.longValue()); operatorContext .getStats() .setLongStat(Metric.TIME_DISK_SCAN_WAIT, parquetReaderStats.timeDiskScanWait.longValue()); operatorContext .getStats() .setLongStat(Metric.TIME_DISK_SCAN, parquetReaderStats.timeDiskScan.longValue()); }