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



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java
##########
@@ -762,9 +756,20 @@ public TimeseriesQuery toTimeseriesQuery()
           
Iterables.getOnlyElement(grouping.getDimensions()).toDimensionSpec().getOutputName()
       );
       if (sorting != null) {
-        // If there is sorting, set timeseriesLimit to given value if less 
than Integer.Max_VALUE
-        if (sorting.isLimited()) {
-          timeseriesLimit = Ints.checkedCast(sorting.getLimit());
+        if (sorting.getOffsetLimit().hasOffset()) {
+          // Timeseries cannot handle offsets.
+          return null;
+        }
+
+        if (sorting.getOffsetLimit().hasLimit()) {
+          final long limit = sorting.getOffsetLimit().getLimit();
+
+          if (limit == 0) {

Review comment:
       That's true; at this point, a zero should be treated as an explicit 
zero. The native timeseries query treats `0` and `null` equivalently and both 
result in an unlimited query. So we have to bail out if the limit is an 
explicit zero.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to