You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/07/09 17:54:29 UTC

[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #5671: Rewrite non-aggregate group by query to distinct query

fx19880617 commented on a change in pull request #5671:
URL: https://github.com/apache/incubator-pinot/pull/5671#discussion_r452391596



##########
File path: pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
##########
@@ -196,13 +198,25 @@ private static boolean isAggregateExpression(Expression expression) {
     return false;
   }
 
-  public static Set<String> extractIdentifiers(List<Expression> expressions) {
+  /**
+   * Extract all the identifiers from given expressions.
+   *
+   * @param expressions
+   * @param excludeAs if true, ignores the right side identifier for AS function.
+   * @return all the identifier names.
+   */
+  public static Set<String> extractIdentifiers(List<Expression> expressions, boolean excludeAs) {

Review comment:
       I see, if those args are single-quoted then it should be fine .

##########
File path: pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
##########
@@ -331,12 +345,59 @@ private static void queryRewrite(PinotQuery pinotQuery) {
       pinotQuery.setFilterExpression(updatedFilterExpression);
     }
 
+    // Rewrite GroupBy to Distinct
+    rewriteNonAggregationGroupByToDistinct(pinotQuery);
+
     // Update alias
     Map<Identifier, Expression> aliasMap = extractAlias(pinotQuery.getSelectList());
     applyAlias(aliasMap, pinotQuery);
     validate(aliasMap, pinotQuery);
   }
 
+  private static void rewriteNonAggregationGroupByToDistinct(PinotQuery pinotQuery) {

Review comment:
       will do 




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org