siddharthteotia commented on a change in pull request #4535: Implement DISTINCT
clause
URL: https://github.com/apache/incubator-pinot/pull/4535#discussion_r315355301
##########
File path:
pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FunctionCallAstNode.java
##########
@@ -82,10 +85,30 @@ public AggregationInfo buildAggregationInfo() {
expression = "*";
} else {
List<? extends AstNode> children = getChildren();
- if (children == null || children.size() != 1) {
- throw new Pql2CompilationException("Aggregation function expects exact
1 argument");
+ if (children == null) {
+ throw new Pql2CompilationException("Aggregation function expects
non-null argument");
+ }
+ if (!_name.equalsIgnoreCase("distinct")) {
Review comment:
For this particular change, we need to specially check for DISTINCT because
by doing the function based execution underneath we are breaking the invariant
that all aggregation functions (SUM, MIN,MAX etc) will have exactly one
argument. So the conditional check becomes something like:
If we are having an aggregate function other than DISTINCT then assert if we
don't have one argument
As you see in the existing code, COUNT(*) is also treated specially since
there the function node doesn't have any children
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]