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

[Coral-Hive] Add missing Hive multi-dimensional aggregation functions: GROUPING_SE… #517

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JiaLiangC
Copy link

…TS, ROLLUP, and CUBE

What changes are proposed in this pull request, and why are they necessary?

Add missing Hive multidimensional aggregation functions (GROUPING SETS, CUBE, ROLLUP) to the coral-hive module.

How was this patch tested?

tested by run unit test

@JiaLiangC
Copy link
Author

@wmoustafa Could you help review it?

@@ -63,6 +64,7 @@

import static com.google.common.base.Preconditions.checkState;
import static java.lang.String.format;
import static org.apache.calcite.sql.fun.SqlStdOperatorTable.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us remove this for consistency with the rest of the file.


@Override
protected SqlNode visitGroupingSets(ASTNode node, ParseContext ctx){
// When Hive recognizes a grouping set, it omits the group by node in the constructed AST.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: GROUP BY for readability here and the rest of the comments.

@Override
protected SqlNode visitGroupingSets(ASTNode node, ParseContext ctx){
// When Hive recognizes a grouping set, it omits the group by node in the constructed AST.
// However, Calcite requires the grouping set to be within a group by node when building SqlNode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not very clear. You might depict the structure of the two trees using an example.

Comment on lines +534 to +536
if(ctx.grpBy == null){
ctx.grpBy = new SqlNodeList(new ArrayList<SqlNode>(), ZERO);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a similar comment on the relationship between the two representations? Here and in RollUp.

@wmoustafa
Copy link
Contributor

Thanks for the PR. I think it still needs some more work:

1- Conversion from SqlNode to RelNode.
2- Conversion from RelNode to SqlNode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants