@Override public final ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { this.iterators = new UnionResultIterators(plans, parentContext); ResultIterator scanner; boolean isOrdered = !orderBy.getOrderByExpressions().isEmpty(); if (isOrdered) { // TopN scanner = new MergeSortTopNResultIterator(iterators, limit, offset, orderBy.getOrderByExpressions()); } else { scanner = new ConcatResultIterator(iterators); if (offset != null) { scanner = new OffsetResultIterator(scanner, offset); } if (limit != null) { scanner = new LimitingResultIterator(scanner, limit); } } return scanner; }
@Override public Tuple next() throws SQLException { if (rowCount++ >= limit) { close(); // Free resources early return null; } return super.next(); }
@Override protected PeekingResultIterator getDelegate() { return (PeekingResultIterator) super.getDelegate(); }
@Override public ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { ResultIterator iterator = delegate.iterator(scanGrouper, scan); if (where != null) { iterator = new FilterResultIterator(iterator, where); } if (!orderBy.getOrderByExpressions().isEmpty()) { // TopN int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt( QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); iterator = new OrderedResultIterator(iterator, orderBy.getOrderByExpressions(), thresholdBytes, limit, offset, projector.getEstimatedRowByteSize()); } else { if (offset != null) { iterator = new OffsetResultIterator(iterator, offset); } if (limit != null) { iterator = new LimitingResultIterator(iterator, limit); } } if (context.getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, context.getSequenceManager()); } return iterator; }
@Override public Tuple next() throws SQLException { if (rowCount++ >= limit) { close(); // Free resources early return null; } return super.next(); }
@Override protected PeekingResultIterator getDelegate() { return (PeekingResultIterator) super.getDelegate(); }
scanner = new ConcatResultIterator(iterators); if (limit != null) { scanner = new LimitingResultIterator(scanner, limit); scanner = new LimitingResultIterator(scanner, limit);
@Override public Tuple next() throws SQLException { if (rowCount++ >= limit) { close(); // Free resources early return null; } return super.next(); }
@Override protected PeekingResultIterator getDelegate() { return (PeekingResultIterator) super.getDelegate(); }
resultScanner = new LimitingResultIterator(resultScanner, limit);
resultScanner = new LimitingResultIterator(resultScanner, limit);
@Override public final ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { this.iterators = new UnionResultIterators(plans, parentContext); ResultIterator scanner; boolean isOrdered = !orderBy.getOrderByExpressions().isEmpty(); if (isOrdered) { // TopN scanner = new MergeSortTopNResultIterator(iterators, limit, offset, orderBy.getOrderByExpressions()); } else { scanner = new ConcatResultIterator(iterators); if (offset != null) { scanner = new OffsetResultIterator(scanner, offset); } if (limit != null) { scanner = new LimitingResultIterator(scanner, limit); } } return scanner; }
@Override public final ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { this.iterators = new UnionResultIterators(plans, parentContext); ResultIterator scanner; boolean isOrdered = !orderBy.getOrderByExpressions().isEmpty(); if (isOrdered) { // TopN scanner = new MergeSortTopNResultIterator(iterators, limit, offset, orderBy.getOrderByExpressions()); } else { scanner = new ConcatResultIterator(iterators); if (offset != null) { scanner = new OffsetResultIterator(scanner, offset); } if (limit != null) { scanner = new LimitingResultIterator(scanner, limit); } } return scanner; }
@Override public final ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { if (LOG.isDebugEnabled()) { LOG.debug(LogUtil.addCustomAnnotations("Gets ready for iteration: " + scan, connection)); } ResultIterator iterator = new GettingResultIterator(context, where); if (!orderBy.getOrderByExpressions().isEmpty()) { // TopN int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt( QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); iterator = new OrderedResultIterator(iterator, orderBy.getOrderByExpressions(), thresholdBytes, limit, offset, projector.getEstimatedRowByteSize()); } else { if (offset != null) { iterator = new OffsetResultIterator(iterator, offset); } if (limit != null) { iterator = new LimitingResultIterator(iterator, limit); } } if (context.getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, context.getSequenceManager()); } if (LOG.isDebugEnabled()) { LOG.debug(LogUtil.addCustomAnnotations("Iterator ready: " + iterator, connection)); } TraceScope scope = Tracing.startNewSpan(context.getConnection(), "Creating basic query for " + getPlanSteps(iterator)); return (scope.getSpan() != null) ? new TracingIterator(scope, iterator) : iterator; }
@Override public ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { ResultIterator iterator = delegate.iterator(scanGrouper, scan); if (where != null) { iterator = new FilterResultIterator(iterator, where); } if (!orderBy.getOrderByExpressions().isEmpty()) { // TopN int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt( QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); iterator = new OrderedResultIterator(iterator, orderBy.getOrderByExpressions(), thresholdBytes, limit, offset, projector.getEstimatedRowByteSize()); } else { if (offset != null) { iterator = new OffsetResultIterator(iterator, offset); } if (limit != null) { iterator = new LimitingResultIterator(iterator, limit); } } if (context.getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, context.getSequenceManager()); } return iterator; }
@Override public ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { ResultIterator iterator = delegate.iterator(scanGrouper, scan); if (where != null) { iterator = new FilterResultIterator(iterator, where); } if (!orderBy.getOrderByExpressions().isEmpty()) { // TopN int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt( QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); iterator = new OrderedResultIterator(iterator, orderBy.getOrderByExpressions(), thresholdBytes, limit, offset, projector.getEstimatedRowByteSize()); } else { if (offset != null) { iterator = new OffsetResultIterator(iterator, offset); } if (limit != null) { iterator = new LimitingResultIterator(iterator, limit); } } if (context.getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, context.getSequenceManager()); } return iterator; }
scanner = new ConcatResultIterator(iterators); if (limit != null) { scanner = new LimitingResultIterator(scanner, limit); scanner = new LimitingResultIterator(scanner, limit);
resultScanner = new LimitingResultIterator(resultScanner, limit);
resultScanner = new LimitingResultIterator(resultScanner, limit);
scanner = new ConcatResultIterator(iterators); if (limit != null) { scanner = new LimitingResultIterator(scanner, limit); scanner = new LimitingResultIterator(scanner, limit);