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 2021/03/09 17:52:56 UTC

[GitHub] [druid] gianm commented on a change in pull request #10968: fix SQL issue for group by queries with time filter that gets optimized to false

gianm commented on a change in pull request #10968:
URL: https://github.com/apache/druid/pull/10968#discussion_r590591364



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/filtration/CombineAndSimplifyBounds.java
##########
@@ -130,15 +134,24 @@ private static DimFilter doSimplify(final List<DimFilter> children, boolean disj
     // Group Bound filters by dimension, extractionFn, and comparator and compute a RangeSet for each one.
     final Map<BoundRefKey, List<BoundDimFilter>> bounds = new HashMap<>();
 
+    boolean allFalse = true;

Review comment:
       Will `children` ever be empty? If not, consider including a precondition check. If it could be empty: then, if it is empty, this will return a `Filtration.matchNothing()`. Is that OK?

##########
File path: processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
##########
@@ -715,7 +716,11 @@ private DateTime computeUniversalTimestamp()
     if (!timestampStringFromContext.isEmpty()) {
       return DateTimes.utc(Long.parseLong(timestampStringFromContext));
     } else if (Granularities.ALL.equals(granularity)) {
-      final DateTime timeStart = getIntervals().get(0).getStart();
+      final List<Interval> intervals = getIntervals();
+      if (CollectionUtils.isNullOrEmpty(intervals)) {
+        return null;

Review comment:
       Why is `null` correct instead of some specific timestamp? (Whatever the answer is, IMO it'd be good as a comment.)




----------------------------------------------------------------
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