You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/06/04 20:45:32 UTC

[GitHub] [druid] maytasm commented on a change in pull request #9986: Fix groupBy with literal in subquery grouping

maytasm commented on a change in pull request #9986:
URL: https://github.com/apache/druid/pull/9986#discussion_r435538248



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java
##########
@@ -424,16 +425,39 @@ private static Grouping computeGrouping(
 
   /**
    * Builds a {@link Subtotals} object based on {@link Aggregate#getGroupSets()}.
+   *
+   * @throws CannotBuildQueryException if subtotals cannot be computed
    */
   private static Subtotals computeSubtotals(
       final PartialDruidQuery partialQuery,
+      final PlannerContext plannerContext,
       final RowSignature rowSignature
   )
   {
     final Aggregate aggregate = partialQuery.getAggregate();
 
     // dimBitMapping maps from input field position to group set position (dimension number).
-    final int[] dimBitMapping = new int[rowSignature.size()];
+    final int[] dimBitMapping;
+    if (partialQuery.getSelectProject() != null) {
+      int fieldCount = 0;
+      for (final RexNode rexNode : partialQuery.getSelectProject().getChildExps()) {
+        final DruidExpression expression = Expressions.toDruidExpression(
+            plannerContext,
+            rowSignature,
+            rexNode
+        );
+
+        if (expression == null) {
+          throw new CannotBuildQueryException(partialQuery.getSelectProject(), rexNode);

Review comment:
       Done




----------------------------------------------------------------
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org