kishoreg commented on a change in pull request #5259: Support Aggregation
functions with multiple arguments.
URL: https://github.com/apache/incubator-pinot/pull/5259#discussion_r409261308
##########
File path:
pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FunctionCallAstNode.java
##########
@@ -92,52 +91,34 @@ AggregationInfo buildAggregationInfo() {
if (children == null || children.isEmpty()) {
throw new Pql2CompilationException("Aggregation function expects
non-null argument");
}
- if (!_name.equalsIgnoreCase(AggregationFunctionType.DISTINCT.getName()))
{
- if (children.size() != 1) {
- throw new Pql2CompilationException("Aggregation function expects
exactly 1 argument as column name");
- } else {
- expression =
TransformExpressionTree.getStandardExpression(children.get(0));
- }
- } else {
- // DISTINCT
- if (!Pql2Compiler.ENABLE_DISTINCT) {
- throw new Pql2CompilationException("Support for DISTINCT is
currently disabled");
- }
- if (children.size() == 1) {
- // single column DISTINCT query
- // e.g SELECT DISTINCT(col) FROM foo
- if (children.get(0) instanceof StarExpressionAstNode) {
- // DISTINCT(*) is not supported yet. User has to specify each
column that should participate in DISTINCT
- throw new Pql2CompilationException(
- "Syntax error: Pinot currently does not support DISTINCT with
*. Please specify each column name as argument to DISTINCT function");
- }
- expression =
TransformExpressionTree.getStandardExpression(children.get(0));
- } else {
- // multi-column DISTINCT query
- // e.g SELECT DISTINCT(col1, col2) FROM foo
- // we will pass down the column expression to execution code
- // as col1:col2
- Set<String> expressions = new HashSet<>();
- StringBuilder distinctColumnExpr = new StringBuilder();
- int numChildren = children.size();
- for (int i = 0; i < numChildren; ++i) {
- expression =
TransformExpressionTree.getStandardExpression(children.get(i));
- if (expressions.add(expression)) {
- // deduplicate the columns
- if (i != 0) {
- distinctColumnExpr.append(DISTINCT_MULTI_COLUMN_SEPARATOR);
- }
- distinctColumnExpr.append(expression);
- }
+
+ // TODO: Remove all distinct special-casing.
Review comment:
+100
----------------------------------------------------------------
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]