Add aggregation function SET_UNION#14842
Conversation
presto-main/src/main/java/com/facebook/presto/metadata/BuiltInFunctionNamespaceManager.java
Outdated
Show resolved
Hide resolved
|
I wonder if you can just extend SET_AGG to simply override the input method. Everything else should be the same. At the very least, you can use those classes. You don't need the new state and factory classes, I don't think. |
kaikalur
left a comment
There was a problem hiding this comment.
See my comment about reusing the State and Factory functions from SET_AGG for this as well.
Thanks for the review @kaikalur. Actually, in my initial PR, I was re-using the state and factory functions from set_agg but I changed it because I thought that it might be better to separate it out ,since its rare for the other aggregation functions share state, and these classes are rather small anyways. If you feel strongly about it, I can revert to how it was before and directly use SET_AGG state and factory. |
It's code hygiene. Something doing the exact same thing should not be copied. In fact, I tried very hard to change MAP_AGG to use the set stuffs for keys but it became too complicated so I didn't. Also note that they are not sharing state - they are just sharing code :) |
a019e3a to
d8d96e2
Compare
|
No problem @kaikalur, done. |
...o-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/SetUnionFunction.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/SetUnionFunction.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/SetUnionFunction.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/SetUnionFunction.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/SetUnionFunction.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/SetUnionFunction.java
Outdated
Show resolved
Hide resolved
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java
Outdated
Show resolved
Hide resolved
419d267 to
cc4e292
Compare
rongrong
left a comment
There was a problem hiding this comment.
Looks good. Some nits, up to you whether you want to change them.
...o-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/SetUnionFunction.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/SetUnionFunction.java
Outdated
Show resolved
Hide resolved
|
Maybe change the commit title and release note to |
SET_UNION is a more efficient alternative to the common pattern of ARRAY_DISTINCT(FLATTEN(ARRAY_AGG(x)))
Uh oh!
There was an error while loading. Please reload this page.