Skip to content
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

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

Jackie-Jiang
Copy link
Contributor

Description

Enhance TableResizer to support post-aggregation in ORDER-BY clause

Copy link
Contributor

@npawar npawar left a 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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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

@Jackie-Jiang Jackie-Jiang merged commit 2d94cb9 into apache:master Aug 17, 2020
@Jackie-Jiang Jackie-Jiang deleted the post_aggregation_4 branch August 17, 2020 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants