private ScanPlan(StatementContext context, FilterableStatement statement, TableRef table, RowProjector projector, Integer limit, Integer offset, OrderBy orderBy, ParallelIteratorFactory parallelIteratorFactory, boolean allowPageFilter, Expression dynamicFilter, QueryPlan dataPlan) throws SQLException { super(context, statement, table, projector, context.getBindManager().getParameterMetaData(), limit,offset, orderBy, GroupBy.EMPTY_GROUP_BY, parallelIteratorFactory != null ? parallelIteratorFactory : buildResultIteratorFactory(context, statement, table, orderBy, limit, offset, allowPageFilter), dynamicFilter, dataPlan); this.allowPageFilter = allowPageFilter; boolean isOrdered = !orderBy.getOrderByExpressions().isEmpty(); if (isOrdered) { // TopN int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt( QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); ScanRegionObserver.serializeIntoScan(context.getScan(), thresholdBytes, limit == null ? -1 : QueryUtil.getOffsetLimit(limit, offset), orderBy.getOrderByExpressions(), projector.getEstimatedRowByteSize()); } Integer perScanLimit = !allowPageFilter || isOrdered ? null : limit; perScanLimit = QueryUtil.getOffsetLimit(perScanLimit, offset); Pair<Long, Long> estimate = getEstimateOfDataSizeToScanIfWithinThreshold(context, table.getTable(), perScanLimit); this.isDataToScanWithinThreshold = estimate != null; this.isSerial = isSerial(context, statement, tableRef, orderBy, isDataToScanWithinThreshold); if (isSerial) { serialBytesEstimate = estimate.getFirst(); serialRowsEstimate = estimate.getSecond(); serialEstimateInfoTs = StatisticsUtil.NOT_STATS_BASED_TS; } }
private ScanPlan(StatementContext context, FilterableStatement statement, TableRef table, RowProjector projector, Integer limit, Integer offset, OrderBy orderBy, ParallelIteratorFactory parallelIteratorFactory, boolean allowPageFilter, Expression dynamicFilter, QueryPlan dataPlan) throws SQLException { super(context, statement, table, projector, context.getBindManager().getParameterMetaData(), limit,offset, orderBy, GroupBy.EMPTY_GROUP_BY, parallelIteratorFactory != null ? parallelIteratorFactory : buildResultIteratorFactory(context, statement, table, orderBy, limit, offset, allowPageFilter), dynamicFilter, dataPlan); this.allowPageFilter = allowPageFilter; boolean isOrdered = !orderBy.getOrderByExpressions().isEmpty(); if (isOrdered) { // TopN int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt( QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); ScanRegionObserver.serializeIntoScan(context.getScan(), thresholdBytes, limit == null ? -1 : QueryUtil.getOffsetLimit(limit, offset), orderBy.getOrderByExpressions(), projector.getEstimatedRowByteSize()); } Integer perScanLimit = !allowPageFilter || isOrdered ? null : limit; perScanLimit = QueryUtil.getOffsetLimit(perScanLimit, offset); Pair<Long, Long> estimate = getEstimateOfDataSizeToScanIfWithinThreshold(context, table.getTable(), perScanLimit); this.isDataToScanWithinThreshold = estimate != null; this.isSerial = isSerial(context, statement, tableRef, orderBy, isDataToScanWithinThreshold); if (isSerial) { serialBytesEstimate = estimate.getFirst(); serialRowsEstimate = estimate.getSecond(); serialEstimateInfoTs = StatisticsUtil.NOT_STATS_BASED_TS; } }
private ScanPlan(StatementContext context, FilterableStatement statement, TableRef table, RowProjector projector, Integer limit, Integer offset, OrderBy orderBy, ParallelIteratorFactory parallelIteratorFactory, boolean allowPageFilter, Expression dynamicFilter, QueryPlan dataPlan) throws SQLException { super(context, statement, table, projector, context.getBindManager().getParameterMetaData(), limit,offset, orderBy, GroupBy.EMPTY_GROUP_BY, parallelIteratorFactory != null ? parallelIteratorFactory : buildResultIteratorFactory(context, statement, table, orderBy, limit, offset, allowPageFilter), dynamicFilter, dataPlan); this.allowPageFilter = allowPageFilter; boolean isOrdered = !orderBy.getOrderByExpressions().isEmpty(); if (isOrdered) { // TopN int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt( QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); ScanRegionObserver.serializeIntoScan(context.getScan(), thresholdBytes, limit == null ? -1 : QueryUtil.getOffsetLimit(limit, offset), orderBy.getOrderByExpressions(), projector.getEstimatedRowByteSize()); } Integer perScanLimit = !allowPageFilter || isOrdered ? null : limit; perScanLimit = QueryUtil.getOffsetLimit(perScanLimit, offset); Pair<Long, Long> estimate = getEstimateOfDataSizeToScanIfWithinThreshold(context, table.getTable(), perScanLimit); this.isDataToScanWithinThreshold = estimate != null; this.isSerial = isSerial(context, statement, tableRef, orderBy, isDataToScanWithinThreshold); if (isSerial) { serialBytesEstimate = estimate.getFirst(); serialRowsEstimate = estimate.getSecond(); serialEstimateInfoTs = StatisticsUtil.NOT_STATS_BASED_TS; } }