} else if (this.hasAggregation()) { logger.info("pre aggregating results before returning"); this.doingStorageAggregation = true;
private void validate(GTInfo info) { if (hasAggregation()) { if (aggrGroupBy.intersects(aggrMetrics) || aggrGroupBy.intersects(rtAggrMetrics)) throw new IllegalStateException(); if (aggrMetrics.cardinality() != aggrMetricsFuncs.length) throw new IllegalStateException(); if (columns == null) columns = ImmutableBitSet.EMPTY; columns = columns.or(aggrGroupBy); columns = columns.or(aggrMetrics); } if (columns == null) columns = info.colAll; if (hasFilterPushDown()) { validateFilterPushDown(info); } this.selectedColBlocks = info.selectColumnBlocks(columns.or(rtAggrMetrics).andNot(dynamicCols)); }
public GTAggregateScanner(IGTScanner input, GTScanRequest req, boolean spillEnabled) { if (!req.hasAggregation()) throw new IllegalStateException(); if (input instanceof GTFilterScanner) { logger.info("setting IGTBypassChecker of child"); ((GTFilterScanner) input).setChecker(this); } else { logger.info("applying a GTFilterScanner with IGTBypassChecker on top child"); input = new GTFilterScanner(input, null, this); } this.inputScanner = input; this.info = this.inputScanner.getInfo(); this.dimensions = req.getDimensions(); this.groupBy = req.getAggrGroupBy(); this.metrics = req.getAggrMetrics(); this.metricsAggrFuncs = req.getAggrMetricsFuncs(); this.measureCodec = req.createMeasureCodec(); this.spillThreshold = (long) (req.getAggCacheMemThreshold() * MemoryBudgetController.ONE_GB); this.aggrMask = new boolean[metricsAggrFuncs.length]; this.storagePushDownLimit = req.getStoragePushDownLimit(); this.storageLimitLevel = req.getStorageLimitLevel(); this.spillEnabled = spillEnabled; this.havingFilter = req.getHavingFilterPushDown(); this.aggrCache = new AggregationCache(); Arrays.fill(aggrMask, true); }
private void validateFilterPushDown(GTInfo info) { if (!hasFilterPushDown()) return; Set<TblColRef> filterColumns = Sets.newHashSet(); TupleFilter.collectColumns(filterPushDown, filterColumns); for (TblColRef col : filterColumns) { // filter columns must belong to the table info.validateColRef(col); // filter columns must be returned to satisfy upper layer evaluation (calcite) columns = columns.set(col.getColumnDesc().getZeroBasedIndex()); } // un-evaluatable filter must be removed if (!TupleFilter.isEvaluableRecursively(filterPushDown)) { Set<TblColRef> unevaluableColumns = Sets.newHashSet(); filterPushDown = GTUtil.convertFilterUnevaluatable(filterPushDown, info, unevaluableColumns); // columns in un-evaluatable filter must be returned without loss so upper layer can do final evaluation if (hasAggregation()) { for (TblColRef col : unevaluableColumns) { aggrGroupBy = aggrGroupBy.set(col.getColumnDesc().getZeroBasedIndex()); } } } }
} else if (this.hasAggregation()) { logger.info("pre aggregating results before returning"); this.doingStorageAggregation = true;
private void validate(GTInfo info) { if (hasAggregation()) { if (aggrGroupBy.intersects(aggrMetrics) || aggrGroupBy.intersects(rtAggrMetrics)) throw new IllegalStateException(); if (aggrMetrics.cardinality() != aggrMetricsFuncs.length) throw new IllegalStateException(); if (columns == null) columns = ImmutableBitSet.EMPTY; columns = columns.or(aggrGroupBy); columns = columns.or(aggrMetrics); } if (columns == null) columns = info.colAll; if (hasFilterPushDown()) { validateFilterPushDown(info); } this.selectedColBlocks = info.selectColumnBlocks(columns.or(rtAggrMetrics).andNot(dynamicCols)); }
public GTAggregateScanner(IGTScanner input, GTScanRequest req, boolean spillEnabled) { if (!req.hasAggregation()) throw new IllegalStateException(); if (input instanceof GTFilterScanner) { logger.info("setting IGTBypassChecker of child"); ((GTFilterScanner) input).setChecker(this); } else { logger.info("applying a GTFilterScanner with IGTBypassChecker on top child"); input = new GTFilterScanner(input, null, this); } this.inputScanner = input; this.info = this.inputScanner.getInfo(); this.dimensions = req.getDimensions(); this.groupBy = req.getAggrGroupBy(); this.metrics = req.getAggrMetrics(); this.metricsAggrFuncs = req.getAggrMetricsFuncs(); this.measureCodec = req.createMeasureCodec(); this.spillThreshold = (long) (req.getAggCacheMemThreshold() * MemoryBudgetController.ONE_GB); this.aggrMask = new boolean[metricsAggrFuncs.length]; this.storagePushDownLimit = req.getStoragePushDownLimit(); this.storageLimitLevel = req.getStorageLimitLevel(); this.spillEnabled = spillEnabled; this.havingFilter = req.getHavingFilterPushDown(); this.aggrCache = new AggregationCache(); Arrays.fill(aggrMask, true); }
private void validateFilterPushDown(GTInfo info) { if (!hasFilterPushDown()) return; Set<TblColRef> filterColumns = Sets.newHashSet(); TupleFilter.collectColumns(filterPushDown, filterColumns); for (TblColRef col : filterColumns) { // filter columns must belong to the table info.validateColRef(col); // filter columns must be returned to satisfy upper layer evaluation (calcite) columns = columns.set(col.getColumnDesc().getZeroBasedIndex()); } // un-evaluatable filter must be removed if (!TupleFilter.isEvaluableRecursively(filterPushDown)) { Set<TblColRef> unevaluableColumns = Sets.newHashSet(); filterPushDown = GTUtil.convertFilterUnevaluatable(filterPushDown, info, unevaluableColumns); // columns in un-evaluatable filter must be returned without loss so upper layer can do final evaluation if (hasAggregation()) { for (TblColRef col : unevaluableColumns) { aggrGroupBy = aggrGroupBy.set(col.getColumnDesc().getZeroBasedIndex()); } } } }