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 2022/04/22 15:48:32 UTC

[GitHub] [druid] rohangarg commented on a diff in pull request #12472: Convert simple min/max SQL queries on __time to timeBoundary queries

rohangarg commented on code in PR #12472:
URL: https://github.com/apache/druid/pull/12472#discussion_r856362843


##########
processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQueryQueryToolChest.java:
##########
@@ -224,4 +226,40 @@ public Result<TimeBoundaryResultValue> apply(Object input)
       }
     };
   }
+
+  @Override
+  public RowSignature resultArraySignature(TimeBoundaryQuery query)
+  {
+    if (query.isMinTime() || query.isMaxTime()) {
+      RowSignature.Builder builder = RowSignature.builder();
+      String outputName = query.isMinTime() ?
+                          query.getContextValue(TimeBoundaryQuery.MIN_TIME_ARRAY_OUTPUT_NAME, TimeBoundaryQuery.MIN_TIME) :
+                          query.getContextValue(TimeBoundaryQuery.MAX_TIME_ARRAY_OUTPUT_NAME, TimeBoundaryQuery.MAX_TIME);
+      return builder.add(outputName, ColumnType.LONG).build();
+    }
+    return super.resultArraySignature(query);

Review Comment:
   Yes, I'll update the exception to something more meaningful.
   
   Regarding, the handling of min-max part. Yes, the native query returns both min-max if no bounds given. But in the first implementation, it was becoming a bit dirty to map the min-max results of a SQL query so decided to throw it for a start. Will take another stab to see if we can accommodate `SELECT min(__time), max(__time) from ds` and `SELECT max(__time), min(__time) from ds`



-- 
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-unsubscribe@druid.apache.org

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