Impala Public Jenkins has submitted this change and it was merged. ( 
https://gerrit.cloudera.org/25385 )

Change subject: IMPALA-15751: Don't materialize partition slots for analytic 
functions
......................................................................

IMPALA-15751: Don't materialize partition slots for analytic functions

Impala only materializes the slots a query actually needs. For an HDFS
scan, partition-pruning predicates such as "month = 1" are consumed by
HdfsPartitionPruner and removed from the scan conjuncts before slots are
materialized, so a partition column referenced only by such a predicate
is normally not materialized.

This optimization was not applied when the query block also contains an
analytic function. In that case SelectStmt.materializeRequiredSlots()
gathers all unassigned conjuncts bound to the scan and analytic tuples
and marks their slots materialized, and this runs before partition
pruning removes the partition conjunct. As a result a partition column
used only for pruning was materialized unnecessarily, and its slot was
carried from the scan up through the analytic sort tuple, inflating the
estimated row size by the width of the partition column. It also made
the legacy planner's row sizes differ from the Calcite planner, which
already drops such columns.

This fixes materializeRequiredSlots() to skip conjuncts that are bound
only to partition columns, mirroring the existing handling of predicates
pushed down to Kudu. The partition predicate is still evaluated by
partition pruning. Only the unnecessary slot materialization is avoided.

Testing
 - Added planner tests.
 - Updated the HBO tests to use the reduced row sizes.

Assisted-by: Opus 4.8 (Claude Code)
Change-Id: I1817304179c6512ea0109aada3e88277080ef8fc
Reviewed-on: https://gerrit.cloudera.org/25385
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M fe/src/main/java/org/apache/impala/analysis/SelectStmt.java
M testdata/workloads/functional-planner/queries/PlannerTest/analytic-fns.test
M testdata/workloads/functional-query/queries/QueryTest/hbo-analytic-agg.test
M testdata/workloads/functional-query/queries/QueryTest/hbo-analytic-join.test
4 files changed, 148 insertions(+), 38 deletions(-)

Approvals:
  Impala Public Jenkins: Looks good to me, approved; Verified

--
To view, visit https://gerrit.cloudera.org/25385
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1817304179c6512ea0109aada3e88277080ef8fc
Gerrit-Change-Number: 25385
Gerrit-PatchSet: 6
Gerrit-Owner: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Steve Carlin <[email protected]>

Reply via email to