@Override public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner, Scan scan, String physicalTableName, QueryPlan plan) throws SQLException { return LookAheadResultIterator.wrap(scanner); } };
public UnionResultIterators(List<QueryPlan> plans, StatementContext parentStmtCtx) throws SQLException { this.parentStmtCtx = parentStmtCtx; int nPlans = plans.size(); iterators = Lists.newArrayListWithExpectedSize(nPlans); splits = Lists.newArrayListWithExpectedSize(nPlans * 30); scans = Lists.newArrayListWithExpectedSize(nPlans * 10); readMetricsList = Lists.newArrayListWithCapacity(nPlans); overAllQueryMetricsList = Lists.newArrayListWithCapacity(nPlans); for (QueryPlan plan : plans) { readMetricsList.add(plan.getContext().getReadMetricsQueue()); overAllQueryMetricsList.add(plan.getContext().getOverallQueryMetrics()); iterators.add(LookAheadResultIterator.wrap(plan.iterator())); splits.addAll(plan.getSplits()); scans.addAll(plan.getScans()); } }
@Override public ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { StatementContext context = delegate.getContext(); if (resultIterator == null) { context.getOverallQueryMetrics().startQuery(); resultIterator = new CursorResultIterator(LookAheadResultIterator.wrap(delegate.iterator(scanGrouper, scan)),cursorName); } return resultIterator; }
renewScannerLeaseThreshold, queryPlan, MapReduceParallelScanGrouper.getInstance()); PeekingResultIterator peekingResultIterator = LookAheadResultIterator.wrap (tableResultIterator); iterators.add(peekingResultIterator);
@Override public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner, Scan scan, String physicalTableName, QueryPlan plan) throws SQLException { return LookAheadResultIterator.wrap(scanner); } };
@Override public PeekingResultIterator newIterator(StatementContext context, ResultIterator scanner, Scan scan, String physicalTableName, QueryPlan plan) throws SQLException { return LookAheadResultIterator.wrap(scanner); } };
aggResultIterator = new ClientUngroupedAggregatingResultIterator(LookAheadResultIterator.wrap(iterator), serverAggregators); aggResultIterator = new UngroupedAggregatingResultIterator(LookAheadResultIterator.wrap(aggResultIterator), clientAggregators); } else { List<Expression> keyExpressions = groupBy.getKeyExpressions(); if (groupBy.isOrderPreserving()) { aggResultIterator = new ClientGroupedAggregatingResultIterator(LookAheadResultIterator.wrap(iterator), serverAggregators, keyExpressions); } else { int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt } else { iterator = new OrderedResultIterator(iterator, keyExpressionOrderBy, thresholdBytes, null, null, projector.getEstimatedRowByteSize()); aggResultIterator = new ClientGroupedAggregatingResultIterator(LookAheadResultIterator.wrap(iterator), serverAggregators, keyExpressions); aggResultIterator = new GroupedAggregatingResultIterator(LookAheadResultIterator.wrap(aggResultIterator), clientAggregators);
private ResultIterator peekForPersistentCache(ResultIterator iterator, ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { // The persistent subquery is optimistic and assumes caches are present on region // servers. We verify that this is the case by peeking at one result. If there is // a cache missing exception, we retry the query with the persistent cache disabled // for that specific cache ID. PeekingResultIterator peeking = LookAheadResultIterator.wrap(iterator); try { peeking.peek(); } catch (Exception e) { try { throw ServerUtil.parseServerException(e); } catch (HashJoinCacheNotFoundException e2) { Long cacheId = e2.getCacheId(); if (delegate.getContext().getRetryingPersistentCache(cacheId)) { throw e2; } delegate.getContext().setRetryingPersistentCache(cacheId); return iterator(scanGrouper, scan); } } return peeking; }
peekingResultIterator = LookAheadResultIterator.wrap(tableSnapshotResultIterator); LOG.info("Adding TableSnapshotResultIterator for scan: " + scan); } else { scanMetricsHolder, renewScannerLeaseThreshold, queryPlan, MapReduceParallelScanGrouper.getInstance()); peekingResultIterator = LookAheadResultIterator.wrap(tableResultIterator); LOG.info("Adding TableResultIterator for scan: " + scan);
scanMetricsHolder, renewScannerLeaseThreshold, queryPlan, MapReduceParallelScanGrouper.getInstance()); peekingResultIterator = LookAheadResultIterator.wrap(tableResultIterator); iterators.add(peekingResultIterator);
public UnionResultIterators(List<QueryPlan> plans, StatementContext parentStmtCtx) throws SQLException { this.parentStmtCtx = parentStmtCtx; int nPlans = plans.size(); iterators = Lists.newArrayListWithExpectedSize(nPlans); splits = Lists.newArrayListWithExpectedSize(nPlans * 30); scans = Lists.newArrayListWithExpectedSize(nPlans * 10); readMetricsList = Lists.newArrayListWithCapacity(nPlans); overAllQueryMetricsList = Lists.newArrayListWithCapacity(nPlans); for (QueryPlan plan : plans) { readMetricsList.add(plan.getContext().getReadMetricsQueue()); overAllQueryMetricsList.add(plan.getContext().getOverallQueryMetrics()); iterators.add(LookAheadResultIterator.wrap(plan.iterator())); splits.addAll(plan.getSplits()); scans.addAll(plan.getScans()); } }
public UnionResultIterators(List<QueryPlan> plans, StatementContext parentStmtCtx) throws SQLException { this.parentStmtCtx = parentStmtCtx; int nPlans = plans.size(); iterators = Lists.newArrayListWithExpectedSize(nPlans); splits = Lists.newArrayListWithExpectedSize(nPlans * 30); scans = Lists.newArrayListWithExpectedSize(nPlans * 10); readMetricsList = Lists.newArrayListWithCapacity(nPlans); overAllQueryMetricsList = Lists.newArrayListWithCapacity(nPlans); for (QueryPlan plan : plans) { readMetricsList.add(plan.getContext().getReadMetricsQueue()); overAllQueryMetricsList.add(plan.getContext().getOverallQueryMetrics()); iterators.add(LookAheadResultIterator.wrap(plan.iterator())); splits.addAll(plan.getSplits()); scans.addAll(plan.getScans()); } }
@Override public ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { StatementContext context = delegate.getContext(); if (resultIterator == null) { context.getOverallQueryMetrics().startQuery(); resultIterator = new CursorResultIterator(LookAheadResultIterator.wrap(delegate.iterator(scanGrouper, scan)),cursorName); } return resultIterator; }
@Override public ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { StatementContext context = delegate.getContext(); if (resultIterator == null) { context.getOverallQueryMetrics().startQuery(); resultIterator = new CursorResultIterator(LookAheadResultIterator.wrap(delegate.iterator(scanGrouper, scan)),cursorName); } return resultIterator; }
aggResultIterator = new ClientUngroupedAggregatingResultIterator(LookAheadResultIterator.wrap(iterator), serverAggregators); aggResultIterator = new UngroupedAggregatingResultIterator(LookAheadResultIterator.wrap(aggResultIterator), clientAggregators); } else { List<Expression> keyExpressions = groupBy.getKeyExpressions(); if (groupBy.isOrderPreserving()) { aggResultIterator = new ClientGroupedAggregatingResultIterator(LookAheadResultIterator.wrap(iterator), serverAggregators, keyExpressions); } else { int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt } else { iterator = new OrderedResultIterator(iterator, keyExpressionOrderBy, thresholdBytes, null, null, projector.getEstimatedRowByteSize()); aggResultIterator = new ClientGroupedAggregatingResultIterator(LookAheadResultIterator.wrap(iterator), serverAggregators, keyExpressions); aggResultIterator = new GroupedAggregatingResultIterator(LookAheadResultIterator.wrap(aggResultIterator), clientAggregators);
private ResultIterator peekForPersistentCache(ResultIterator iterator, ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { // The persistent subquery is optimistic and assumes caches are present on region // servers. We verify that this is the case by peeking at one result. If there is // a cache missing exception, we retry the query with the persistent cache disabled // for that specific cache ID. PeekingResultIterator peeking = LookAheadResultIterator.wrap(iterator); try { peeking.peek(); } catch (Exception e) { try { throw ServerUtil.parseServerException(e); } catch (HashJoinCacheNotFoundException e2) { Long cacheId = e2.getCacheId(); if (delegate.getContext().getRetryingPersistentCache(cacheId)) { throw e2; } delegate.getContext().setRetryingPersistentCache(cacheId); return iterator(scanGrouper, scan); } } return peeking; }
aggResultIterator = new ClientUngroupedAggregatingResultIterator(LookAheadResultIterator.wrap(iterator), serverAggregators); aggResultIterator = new UngroupedAggregatingResultIterator(LookAheadResultIterator.wrap(aggResultIterator), clientAggregators); } else { if (!groupBy.isOrderPreserving()) { aggResultIterator = new ClientGroupedAggregatingResultIterator(LookAheadResultIterator.wrap(iterator), serverAggregators, groupBy.getKeyExpressions()); aggResultIterator = new GroupedAggregatingResultIterator(LookAheadResultIterator.wrap(aggResultIterator), clientAggregators);
peekingResultIterator = LookAheadResultIterator.wrap(tableSnapshotResultIterator); } else { final TableResultIterator tableResultIterator = scanMetricsHolder, renewScannerLeaseThreshold, queryPlan, MapReduceParallelScanGrouper.getInstance()); peekingResultIterator = LookAheadResultIterator.wrap(tableResultIterator);
peekingResultIterator = LookAheadResultIterator.wrap(tableSnapshotResultIterator); } else { final TableResultIterator tableResultIterator = scanMetricsHolder, renewScannerLeaseThreshold, queryPlan, MapReduceParallelScanGrouper.getInstance()); peekingResultIterator = LookAheadResultIterator.wrap(tableResultIterator);