walterddr commented on a change in pull request #8158: URL: https://github.com/apache/pinot/pull/8158#discussion_r805174987
########## File path: pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java ########## @@ -710,14 +711,18 @@ private static Expression compileFunctionExpression(SqlBasicCall functionNode) { compilePathExpression(functionName, functionNode, path); return RequestUtils.getIdentifierExpression(path.toString()); } + if ((functionNode.getFunctionQuantifier() != null) && ("DISTINCT".equals( + functionNode.getFunctionQuantifier().toString()))) { + functionName = "DISTINCTCOUNT"; Review comment: why is this `DISTINCTCOUNT` shouldn't it be derived from the functionNode? it doesn't seem like the COUNT branch fall through here. also can we add a test? ########## File path: pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java ########## @@ -710,14 +711,18 @@ private static Expression compileFunctionExpression(SqlBasicCall functionNode) { compilePathExpression(functionName, functionNode, path); return RequestUtils.getIdentifierExpression(path.toString()); } + if ((functionNode.getFunctionQuantifier() != null) && ("DISTINCT".equals( + functionNode.getFunctionQuantifier().toString()))) { + functionName = "DISTINCTCOUNT"; Review comment: why is this `DISTINCTCOUNT`? shouldn't it be derived from the functionNode? it doesn't seem like the COUNT branch fall through here. also can we add a test? ########## File path: pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java ########## @@ -710,14 +711,18 @@ private static Expression compileFunctionExpression(SqlBasicCall functionNode) { compilePathExpression(functionName, functionNode, path); return RequestUtils.getIdentifierExpression(path.toString()); } + if ((functionNode.getFunctionQuantifier() != null) && ("DISTINCT".equals( + functionNode.getFunctionQuantifier().toString()))) { + functionName = "DISTINCTCOUNT"; Review comment: yes but the test is for `count(distinct ..` rewrite, i suspect this would not work for something like `SUM(distinct ` will basically fail. and i dont see a test like that one. @xiangfu0 ^ are we planning to support anything similar to this? ########## File path: pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java ########## @@ -710,14 +711,18 @@ private static Expression compileFunctionExpression(SqlBasicCall functionNode) { compilePathExpression(functionName, functionNode, path); return RequestUtils.getIdentifierExpression(path.toString()); } + if ((functionNode.getFunctionQuantifier() != null) && ("DISTINCT".equals( + functionNode.getFunctionQuantifier().toString()))) { + functionName = "DISTINCTCOUNT"; Review comment: yes but the test is for `count(distinct ..` rewrite, i suspect this would not work for something like `SUM(distinct ...` will basically fail. and i dont see a test like that one. @xiangfu0 ^ are we planning to support anything similar to this? -- 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. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org