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/07 05:23:07 UTC

[GitHub] [druid] jihoonson opened a new pull request #10253: Allow forceLimitPushDown in SQL

jihoonson opened a new pull request #10253:
URL: https://github.com/apache/druid/pull/10253


   Fixes https://github.com/apache/druid/issues/9323.
   
   ### Description
   
   `validateAndGetForceLimitPushDown()` can throw an exception while iterating candidate plans in sql planner. This PR postpones validation until it's necessary.
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
      - [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/licenses.yaml)
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.


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


[GitHub] [druid] clintropolis commented on a change in pull request #10253: Allow forceLimitPushDown in SQL

Posted by GitBox <gi...@apache.org>.
clintropolis commented on a change in pull request #10253:
URL: https://github.com/apache/druid/pull/10253#discussion_r468813252



##########
File path: processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
##########
@@ -409,7 +412,10 @@ public boolean getContextSortByDimsFirst()
   @JsonIgnore
   public boolean isApplyLimitPushDown()
   {
-    return applyLimitPushDown;
+    if (forceLimitPushDown == null) {
+      forceLimitPushDown = validateAndGetForceLimitPushDown();
+    }
+    return forceLimitPushDown || canPushDownLimit;

Review comment:
       super nit: it seems funny to have `...LimitPushDown` and `...PushDownLimit`, but I'm not really sure what is the best way to square these up. I guess `...LimitPushDown` is more prevalent, so maybe renaming to `canDoLimitPushDown` to be more consistent?

##########
File path: processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
##########
@@ -121,6 +120,10 @@ public static Builder builder()
   @Nullable
   private final DateTime universalTimestamp;
 
+  private final boolean canPushDownLimit;
+  @Nullable
+  private Boolean forceLimitPushDown;

Review comment:
       I think this would cause extra calls to `validateAndGetForceLimitPushDown` whenever `isApplyLimitPushdown` is called because of being unable to distinguish between an actual `false` and the value not being computed yet. It's probably not especially harmful, but it also seems unnecessary.

##########
File path: processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
##########
@@ -474,14 +480,12 @@ private RowSignature computeResultRowSignature()
                   .build();
   }
 
-  private boolean determineApplyLimitPushDown()
+  private boolean canPushDown()

Review comment:
       nit: this method name should probably include `LimitPushDown` or at least `Limit` somehow to make it clearer that it applies to limits, maybe `canDoLimitPushDown()` if you decide to rename the field as well?




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


[GitHub] [druid] clintropolis merged pull request #10253: Allow forceLimitPushDown in SQL

Posted by GitBox <gi...@apache.org>.
clintropolis merged pull request #10253:
URL: https://github.com/apache/druid/pull/10253


   


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


[GitHub] [druid] jihoonson commented on a change in pull request #10253: Allow forceLimitPushDown in SQL

Posted by GitBox <gi...@apache.org>.
jihoonson commented on a change in pull request #10253:
URL: https://github.com/apache/druid/pull/10253#discussion_r469693227



##########
File path: processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
##########
@@ -474,14 +480,12 @@ private RowSignature computeResultRowSignature()
                   .build();
   }
 
-  private boolean determineApplyLimitPushDown()
+  private boolean canPushDown()

Review comment:
       Added limitSpec, havingSpec, and subtotalsSpec as params and renamed.




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


[GitHub] [druid] suneet-s commented on a change in pull request #10253: Allow forceLimitPushDown in SQL

Posted by GitBox <gi...@apache.org>.
suneet-s commented on a change in pull request #10253:
URL: https://github.com/apache/druid/pull/10253#discussion_r467973549



##########
File path: processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
##########
@@ -121,6 +120,10 @@ public static Builder builder()
   @Nullable
   private final DateTime universalTimestamp;
 
+  private final boolean canPushDownLimit;
+  @Nullable
+  private Boolean forceLimitPushDown;

Review comment:
       Can we default to false instead of making this nullable?
   
   ```suggestion
     private boolean forceLimitPushDown;
   ```




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


[GitHub] [druid] jihoonson commented on a change in pull request #10253: Allow forceLimitPushDown in SQL

Posted by GitBox <gi...@apache.org>.
jihoonson commented on a change in pull request #10253:
URL: https://github.com/apache/druid/pull/10253#discussion_r469693037



##########
File path: processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
##########
@@ -121,6 +120,10 @@ public static Builder builder()
   @Nullable
   private final DateTime universalTimestamp;
 
+  private final boolean canPushDownLimit;
+  @Nullable
+  private Boolean forceLimitPushDown;

Review comment:
       Yeah, it's nullable to lazily initialize and cache it. Checking the value of `forceLimitPushDown` is needed a couple of times during a query. Even though it's not very harmful, I don't see any reason to not cache it.

##########
File path: processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
##########
@@ -409,7 +412,10 @@ public boolean getContextSortByDimsFirst()
   @JsonIgnore
   public boolean isApplyLimitPushDown()
   {
-    return applyLimitPushDown;
+    if (forceLimitPushDown == null) {
+      forceLimitPushDown = validateAndGetForceLimitPushDown();
+    }
+    return forceLimitPushDown || canPushDownLimit;

Review comment:
       Renamed.




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