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/08/20 19:24:01 UTC

[GitHub] [druid] gianm commented on a change in pull request #10279: Add SQL "OFFSET" clause.

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



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