Hello Aman Sinha, Fang-Yu Rao, Riza Suminto, Joe McDonnell, Michael Smith, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit http://gerrit.cloudera.org:8080/23317 to look at the new patch set (#4). Change subject: IMPALA-14115: Calcite planner: Added top-n analytic PlanNode optimization. ...................................................................... IMPALA-14115: Calcite planner: Added top-n analytic PlanNode optimization. Impala has an optimization for analytic expressions that have a rank filter on top of the analytic expression. It can add a top-n plan node to reduce the amount of rows examined. This is tested in tpcds query 67. The optimization logic relies on an unassigned rank conjunct within the analyzer while creating the analytic plan node. A slight reorganization of the code was needed to implement this optimization. The SlotRefs for the AnalyticInfo needed to be created a little earlier from where it was done in the previous commit. A small fix was made to normalize binary predicates. A non-normalized binary predicate prevents the optimization from being used. A call to the checkAndApplyLimitPushdown is needed for some of the optimizations to kick in. A new AllProjectInfo internal class was created to hold the relationships between the Calcite RexNode objects and the Impala Analytic expressions. Also, IMPALA-14158 is fixed by this commit. The nullsFirst value was incorrect when the syntax was explicit in the query. A new Calcite planner test was added in the junit tests to ensure the optimization kicks in. The new test file is in the PlannerTest/calcite/limit-pushdown-analytic-calcite.test file. This is a copy of the limit-pushdown-analytic.test file in its parent directory but with some modified results. Most of the differences are trivial, but IMPALA-14469 has been filed to deal with one optimization that did not get fixed, which is when the order by clause has a constant expression. Change-Id: Ie6fa6781db56771b13b0cf49bd236f776016bf8d --- M fe/src/main/java/org/apache/impala/analysis/SortInfo.java M fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java M fe/src/test/java/org/apache/impala/planner/PlannerTestBase.java M java/calcite-planner/src/main/java/org/apache/impala/calcite/functions/RexCallConverter.java M java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaAggRel.java M java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaAnalyticRel.java M java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaSortRel.java M java/calcite-planner/src/main/java/org/apache/impala/calcite/util/SimplifiedAnalyzer.java A java/calcite-planner/src/test/java/org/apache/impala/planner/CalcitePlannerTest.java A testdata/workloads/functional-planner/queries/PlannerTest/calcite/limit-pushdown-analytic-calcite.test M testdata/workloads/functional-planner/queries/PlannerTest/calcite_tpcds/tpcds-q02.test M testdata/workloads/functional-planner/queries/PlannerTest/calcite_tpcds/tpcds-q08.test M testdata/workloads/functional-planner/queries/PlannerTest/calcite_tpcds/tpcds-q44.test M testdata/workloads/functional-planner/queries/PlannerTest/calcite_tpcds/tpcds-q47.test M testdata/workloads/functional-planner/queries/PlannerTest/calcite_tpcds/tpcds-q57.test M testdata/workloads/functional-planner/queries/PlannerTest/calcite_tpcds/tpcds-q67.test M testdata/workloads/functional-planner/queries/PlannerTest/calcite_tpcds/tpcds-q70.test 17 files changed, 2,477 insertions(+), 917 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/17/23317/4 -- To view, visit http://gerrit.cloudera.org:8080/23317 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ie6fa6781db56771b13b0cf49bd236f776016bf8d Gerrit-Change-Number: 23317 Gerrit-PatchSet: 4 Gerrit-Owner: Steve Carlin <scar...@cloudera.com> Gerrit-Reviewer: Aman Sinha <amsi...@cloudera.com> Gerrit-Reviewer: Fang-Yu Rao <fangyu....@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Gerrit-Reviewer: Joe McDonnell <joemcdonn...@cloudera.com> Gerrit-Reviewer: Michael Smith <michael.sm...@cloudera.com> Gerrit-Reviewer: Riza Suminto <riza.sumi...@cloudera.com>