Make Aggregation use RowExpression instead#12710
Conversation
cb23b2b to
7613f63
Compare
7d299e3 to
07ce82b
Compare
|
@hellium01 is this ready to review? |
|
Yes, it should be OK to review now. It was splitted to small commits but I can squash them after review. |
highker
left a comment
There was a problem hiding this comment.
There are many places still having both getCall and the other new getters. To make it clean, we'd better clean them in one commit.
presto-main/src/main/java/com/facebook/presto/sql/planner/PlannerUtils.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/PlannerUtils.java
Outdated
Show resolved
Hide resolved
.../main/java/com/facebook/presto/sql/planner/iterative/rule/ImplementFilteredAggregations.java
Outdated
Show resolved
Hide resolved
...va/com/facebook/presto/sql/planner/iterative/rule/RewriteSpatialPartitioningAggregation.java
Outdated
Show resolved
Hide resolved
...va/com/facebook/presto/sql/planner/iterative/rule/RewriteSpatialPartitioningAggregation.java
Outdated
Show resolved
Hide resolved
...va/com/facebook/presto/sql/planner/iterative/rule/RewriteSpatialPartitioningAggregation.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
It will be a little long to fit in one line.
...to-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AggregationNodeUtil.java
Outdated
Show resolved
Hide resolved
...java/com/facebook/presto/sql/planner/iterative/rule/TestPushAggregationThroughOuterJoin.java
Outdated
Show resolved
Hide resolved
...to-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AggregationNodeUtil.java
Outdated
Show resolved
Hide resolved
highker
left a comment
There was a problem hiding this comment.
"Change expressionExtractor for aggregation" done
presto-main/src/main/java/com/facebook/presto/sql/planner/SymbolsExtractor.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/SymbolsExtractor.java
Outdated
Show resolved
Hide resolved
...n/src/main/java/com/facebook/presto/sql/planner/iterative/rule/ExpressionRewriteRuleSet.java
Outdated
Show resolved
Hide resolved
...n/java/com/facebook/presto/sql/planner/iterative/rule/PushPartialAggregationThroughJoin.java
Outdated
Show resolved
Hide resolved
highker
left a comment
There was a problem hiding this comment.
Finished the first 3 commits. I think we need some care to make sure refactoring can be easily carried out. Moving arguments out of FunctionCall may not be proper. It loosens the bound as a function. We need to keep the basic signature of a function as a whole and separating out other info like order by or distinct. Keeping arguments inside FunctionCall can help replacing it with CallExpression with one shot. Also, it won't introduce the problem of resolving lambdas.
presto-main/src/main/java/com/facebook/presto/sql/planner/QueryPlanner.java
Outdated
Show resolved
Hide resolved
...cebook/presto/sql/planner/optimizations/TransformQuantifiedComparisonApplyToLateralJoin.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/plan/AggregationNode.java
Outdated
Show resolved
Hide resolved
...va/com/facebook/presto/sql/planner/iterative/rule/RewriteSpatialPartitioningAggregation.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/planPrinter/PlanPrinter.java
Outdated
Show resolved
Hide resolved
203991e to
5157d0e
Compare
8fc4043 to
f0140f0
Compare
|
Rebased on top #12606 |
f0140f0 to
5b6b053
Compare
1966174 to
6d14042
Compare
wenleix
left a comment
There was a problem hiding this comment.
"Modify RowExpressionSymbolInliner to RowExpressionVariableInliner": LGTM % one nit.
presto-main/src/main/java/com/facebook/presto/sql/planner/RowExpressionVariableInliner.java
Show resolved
Hide resolved
wenleix
left a comment
There was a problem hiding this comment.
"Consolidate conversion from OrderBy expression to OrderingScheme".
LGTM % nits.
presto-main/src/main/java/com/facebook/presto/sql/planner/PlannerUtils.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/PlannerUtils.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/PlannerUtils.java
Outdated
Show resolved
Hide resolved
...va/com/facebook/presto/sql/planner/iterative/rule/PushPartialAggregationThroughExchange.java
Outdated
Show resolved
Hide resolved
...in/src/main/java/com/facebook/presto/sql/planner/optimizations/PruneUnreferencedOutputs.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/sql/planner/optimizations/TranslateExpressions.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/sanity/TypeValidator.java
Outdated
Show resolved
Hide resolved
6d14042 to
79349e6
Compare
79349e6 to
11e9fca
Compare
highker
left a comment
There was a problem hiding this comment.
"Modify RowExpressionSymbolInliner to RowExpressionVariableInliner" LGTM
highker
left a comment
There was a problem hiding this comment.
"Replace Expression with RowExpression in Aggregation" minor comments only
presto-main/src/main/java/com/facebook/presto/sql/planner/ExpressionExtractor.java
Outdated
Show resolved
Hide resolved
.../main/java/com/facebook/presto/sql/planner/iterative/rule/PruneAggregationSourceColumns.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AggregationNodeUtils.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AggregationNodeUtils.java
Outdated
Show resolved
Hide resolved
...in/java/com/facebook/presto/sql/planner/optimizations/OptimizeMixedDistinctAggregations.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
let's move this part of logic to the caller. The caller should decide which method to use.
There was a problem hiding this comment.
SymbolMapper will be used in multiple optimization rules. As we are pushing the clean up up, we will need this function to handle both Expression/RowExpression anyway. I would prefer we just remove isExpression later once everything is cleaned up.
presto-main/src/main/java/com/facebook/presto/sql/planner/plan/StatisticAggregations.java
Outdated
Show resolved
Hide resolved
...ain/src/test/java/com/facebook/presto/sql/planner/optimizations/TestTranslateExpression.java
Outdated
Show resolved
Hide resolved
...ain/src/test/java/com/facebook/presto/sql/planner/optimizations/TestTranslateExpression.java
Outdated
Show resolved
Hide resolved
...ain/src/test/java/com/facebook/presto/sql/planner/optimizations/TestTranslateExpression.java
Outdated
Show resolved
Hide resolved
Expression is replaced by RowExpression in AggregationNode#Aggregation. For lambda argument of aggregation, we have to manually provide the types based on Function's signature. The operation is moved from LocalExecutionPlanner to earlier stage.
Since we now have access to CallExpression, we add back checks to make sure function arguments is valid
11e9fca to
a04b4bc
Compare
wenleix
left a comment
There was a problem hiding this comment.
LGTM. Make sure Travis turn green before merge.
Thanks for the great work!
|
@hellium01 Yi, I'm seeing |
This will remove the dependency to Expression in following plan nodes:
It is splitted to small commits that may need to squash together later.