-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29339: Remove DISTINCT indicator from SqlAggFunctions #6212
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,7 @@ | |
| import org.apache.calcite.rex.RexWindowBound; | ||
| import org.apache.calcite.sql.SqlKind; | ||
| import org.apache.calcite.sql.SqlOperator; | ||
| import org.apache.calcite.sql.SqlSyntax; | ||
| import org.apache.calcite.sql.fun.SqlStdOperatorTable; | ||
| import org.apache.calcite.sql.type.SqlTypeName; | ||
| import org.apache.calcite.util.ImmutableBitSet; | ||
|
|
@@ -1000,7 +1001,18 @@ public ASTNode visitOver(RexOver over) { | |
| } | ||
|
|
||
| // 1. Translate the UDAF | ||
| final ASTNode wUDAFAst = visitCall(over); | ||
| ASTNode wUDAFAst = ASTBuilder.createAST(HiveParser.TOK_FUNCTION, "TOK_FUNCTION"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a few lines of comments to explain what it is doing, but not strictly required. |
||
| if (over.getOperands().isEmpty() && over.op.getSyntax() == SqlSyntax.FUNCTION_STAR) { | ||
| wUDAFAst = ASTBuilder.createAST(HiveParser.TOK_FUNCTIONSTAR, "TOK_FUNCTIONSTAR"); | ||
| } | ||
| if (over.isDistinct()) { | ||
| wUDAFAst = ASTBuilder.createAST(HiveParser.TOK_FUNCTIONDI, "TOK_FUNCTIONDI"); | ||
| } | ||
| wUDAFAst.addChild(ASTBuilder.createAST(HiveParser.Identifier, over.op.getName())); | ||
| wUDAFAst.setTypeInfo(TypeConverter.convert(over.type)); | ||
| for (RexNode operand : over.getOperands()) { | ||
| wUDAFAst.addChild(operand.accept(this)); | ||
| } | ||
|
Comment on lines
+1004
to
+1015
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a few lines of comments explaining this part would be nice as it has changed significantly. |
||
|
|
||
| // 2. Add TOK_WINDOW as child of UDAF | ||
| ASTNode wSpec = ASTBuilder.createAST(HiveParser.TOK_WINDOWSPEC, "TOK_WINDOWSPEC"); | ||
|
|
||
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.
nit: If you are changing this line, can we flip the second predicate so that the constant is on the right side? Makes this more readable in my opinion.