/** * @return whether this node should produce default output in case of no input pages. * For example for query: * <p> * SELECT count(*) FROM nation WHERE nationkey < 0 * <p> * A default output of "0" is expected to be produced by FINAL aggregation operator. */ public boolean hasDefaultOutput() { return hasEmptyGroupingSet() && (step.isOutputPartial() || step.equals(SINGLE)); }
@Override public Range<Long> visitAggregation(AggregationNode node, Void context) { if (node.hasEmptyGroupingSet()) { return Range.singleton(1L); } return Range.atLeast(0L); }
@Override public Range<Long> visitAggregation(AggregationNode node, Void context) { if (node.hasEmptyGroupingSet()) { return Range.singleton(1L); } return Range.atLeast(0L); }
/** * @return whether this node should produce default output in case of no input pages. * For example for query: * <p> * SELECT count(*) FROM nation WHERE nationkey < 0 * <p> * A default output of "0" is expected to be produced by FINAL aggregation operator. */ public boolean hasDefaultOutput() { return hasEmptyGroupingSet() && (step.isOutputPartial() || step.equals(SINGLE)); }
public boolean hasSingleNodeExecutionPreference(FunctionRegistry functionRegistry) { // There are two kinds of aggregations the have single node execution preference: // // 1. aggregations with only empty grouping sets like // // SELECT count(*) FROM lineitem; // // there is no need for distributed aggregation. Single node FINAL aggregation will suffice, // since all input have to be aggregated into one line output. // // 2. aggregations that must produce default output and are not decomposable, we can not distribute them. return (hasEmptyGroupingSet() && !hasNonEmptyGroupingSet()) || (hasDefaultOutput() && !isDecomposable(functionRegistry)); }
public boolean hasSingleNodeExecutionPreference(FunctionRegistry functionRegistry) { // There are two kinds of aggregations the have single node execution preference: // // 1. aggregations with only empty grouping sets like // // SELECT count(*) FROM lineitem; // // there is no need for distributed aggregation. Single node FINAL aggregation will suffice, // since all input have to be aggregated into one line output. // // 2. aggregations that must produce default output and are not decomposable, we can not distribute them. return (hasEmptyGroupingSet() && !hasNonEmptyGroupingSet()) || (hasDefaultOutput() && !isDecomposable(functionRegistry)); }
@Override public Optional<DecorrelationResult> visitAggregation(AggregationNode node, Void context) if (node.hasEmptyGroupingSet()) { return Optional.empty();
@Override public Optional<DecorrelationResult> visitAggregation(AggregationNode node, Void context) if (node.hasEmptyGroupingSet()) { return Optional.empty();
if (!node.getStep().equals(FINAL) || !node.hasEmptyGroupingSet()) { return Optional.empty();
if (!node.getStep().equals(FINAL) || !node.hasEmptyGroupingSet()) { return Optional.empty();
@Override public PlanNode visitAggregation(AggregationNode node, RewriteContext<Expression> context) if (node.hasEmptyGroupingSet()) {
@Override public PlanNode visitAggregation(AggregationNode node, RewriteContext<Expression> context) if (node.hasEmptyGroupingSet()) {
aggregationNode.hasEmptyGroupingSet() && aggregationNode.hasNonEmptyGroupingSet() && exchangeNode.getType() == REPARTITION) {
aggregationNode.hasEmptyGroupingSet() && aggregationNode.hasNonEmptyGroupingSet() && exchangeNode.getType() == REPARTITION) {