private static boolean isSupportedAggregationNode(AggregationNode aggregationNode) { // Don't split streaming aggregations if (aggregationNode.isStreamable()) { return false; } if (aggregationNode.getHashSymbol().isPresent()) { // TODO: add support for hash symbol in aggregation node return false; } return aggregationNode.getStep() == PARTIAL && aggregationNode.getGroupingSetCount() == 1; }
private static boolean isSupportedAggregationNode(AggregationNode aggregationNode) { // Don't split streaming aggregations if (aggregationNode.isStreamable()) { return false; } if (aggregationNode.getHashSymbol().isPresent()) { // TODO: add support for hash symbol in aggregation node return false; } return aggregationNode.getStep() == PARTIAL && aggregationNode.getGroupingSetCount() == 1; }
@Override protected Optional<PlanNodeStatsEstimate> doCalculate(AggregationNode node, StatsProvider statsProvider, Lookup lookup, Session session, TypeProvider types) { if (node.getGroupingSetCount() != 1) { return Optional.empty(); } if (node.getStep() != SINGLE) { return Optional.empty(); } return Optional.of(groupBy( statsProvider.getStats(node.getSource()), node.getGroupingKeys(), node.getAggregations())); }
@Override protected Optional<PlanNodeStatsEstimate> doCalculate(AggregationNode node, StatsProvider statsProvider, Lookup lookup, Session session, TypeProvider types) { if (node.getGroupingSetCount() != 1) { return Optional.empty(); } if (node.getStep() != SINGLE) { return Optional.empty(); } return Optional.of(groupBy( statsProvider.getStats(node.getSource()), node.getGroupingKeys(), node.getAggregations())); }
private AggregationNode map(AggregationNode node, PlanNode source, PlanNodeId newNodeId) { ImmutableMap.Builder<Symbol, Aggregation> aggregations = ImmutableMap.builder(); for (Entry<Symbol, Aggregation> entry : node.getAggregations().entrySet()) { aggregations.put(map(entry.getKey()), map(entry.getValue())); } return new AggregationNode( newNodeId, source, aggregations.build(), groupingSets( mapAndDistinct(node.getGroupingKeys()), node.getGroupingSetCount(), node.getGlobalGroupingSets()), ImmutableList.of(), node.getStep(), node.getHashSymbol().map(this::map), node.getGroupIdSymbol().map(this::map)); }
private AggregationNode map(AggregationNode node, PlanNode source, PlanNodeId newNodeId) { ImmutableMap.Builder<Symbol, Aggregation> aggregations = ImmutableMap.builder(); for (Entry<Symbol, Aggregation> entry : node.getAggregations().entrySet()) { aggregations.put(map(entry.getKey()), map(entry.getValue())); } return new AggregationNode( newNodeId, source, aggregations.build(), groupingSets( mapAndDistinct(node.getGroupingKeys()), node.getGroupingSetCount(), node.getGlobalGroupingSets()), ImmutableList.of(), node.getStep(), node.getHashSymbol().map(this::map), node.getGroupIdSymbol().map(this::map)); }
decorrelatedAggregation.getGroupIdSymbol()); boolean atMostSingleRow = newAggregation.getGroupingSetCount() == 1 && constantSymbols.containsAll(newAggregation.getGroupingKeys());
decorrelatedAggregation.getGroupIdSymbol()); boolean atMostSingleRow = newAggregation.getGroupingSetCount() == 1 && constantSymbols.containsAll(newAggregation.getGroupingKeys());
if (groupingSets.getGroupingSetCount() != aggregationNode.getGroupingSetCount()) { return NO_MATCH;
if (groupingSets.getGroupingSetCount() != aggregationNode.getGroupingSetCount()) { return NO_MATCH;