Github user sudheeshkatkam commented on a diff in the pull request:
https://github.com/apache/drill/pull/403#discussion_r58957028
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/FindLimit0Visitor.java
---
@@ -43,7 +50,15 @@
public static boolean containsLimit0(RelNode rel) {
FindLimit0Visitor visitor = new FindLimit0Visitor();
rel.accept(visitor);
- return visitor.isContains();
+
+ if (!visitor.isContains()) {
+ return false;
+ }
+
+ final FindHardDistributionScans hdVisitor = new
FindHardDistributionScans();
+ rel.accept(hdVisitor);
+ // Can't optimize limit 0 if the query contains a table which has hard
distribution requirement.
+ return !hdVisitor.contains();
--- End diff --
LGTM
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---