Alex Behm has posted comments on this change. Change subject: IMPALA-2581: LIMIT can be propagated down into some aggregations ......................................................................
Patch Set 4: (1 comment) http://gerrit.cloudera.org:8080/#/c/3822/4/fe/src/main/java/com/cloudera/impala/analysis/AggregateInfoBase.java File fe/src/main/java/com/cloudera/impala/analysis/AggregateInfoBase.java: Line 182: public boolean isPreaggLimitable() { I think this optimization will produce a wrong plan for queries like this one: select distinct a.int_col, a.bigint_col, b.int_col, b.bigint_col from functional.alltypes a, functional.alltypes b where a.id = b.id having a.int_col + b.int_col < 10 Unfortunately, our planner is not clever enough to move this predicate below the aggregation, but it shows that this optimization does rely on an additional assumption that is not always true for us. I think we can only safely move the limit into the pre-agg if there are no HAVING-clause predicates. Alternatively, we can also move the HAVING clause predicates into the pre-agg. -- To view, visit http://gerrit.cloudera.org:8080/3822 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I59c5b7af7a73ccdbc5496b28eacb9b6859d202bc Gerrit-PatchSet: 4 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Jim Apple <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Jim Apple <[email protected]> Gerrit-Reviewer: Matthew Jacobs <[email protected]> Gerrit-Reviewer: Tim Armstrong <[email protected]> Gerrit-HasComments: Yes
