-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Post-Aggregation] Support post-aggregation in ORDER-BY #5856
Conversation
3dd5cbe
to
c4c4a01
Compare
c4c4a01
to
75c686f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Helper method to construct a OrderByValueExtractor based on the given expression. | ||
*/ | ||
private OrderByValueExtractor getOrderByValueExtractor(ExpressionContext expression) { | ||
if (expression.getType() == ExpressionContext.Type.LITERAL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does it mean to have ORDER BY a literal? can you give an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order-by with literal itself does not make a lot of sense, but post-aggregation might contain literal (e.g. ORDER BY SUM(col1) * 2 - SUM(col2)
)
aggregationColumnToFunction.put(columnName, aggregationFunctions[i - numKeyColumns]); | ||
} | ||
List<ExpressionContext> groupByExpressions = queryContext.getGroupByExpressions(); | ||
assert groupByExpressions != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why using assert instead of Preconditions.checkState?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually use assert to indicate that the value is not possible to be null, which has zero run-time impact, and use checkState to verify certain states
Description
Enhance
TableResizer
to support post-aggregation in ORDER-BY clause