Csaba Ringhofer has submitted this change and it was merged. ( https://gerrit.cloudera.org/24784 )
Change subject: IMPALA-15324: Size exchange memory on input rows ...................................................................... IMPALA-15324: Size exchange memory on input rows ExchangeNode sized both parts of its memory estimate, the row batch queues and the deferred RPC payloads, from its own cardinality, which computeStats() has already reduced by the offset. The senders never apply that offset: DistributedPlanner clears it on the sender-side sort and raises that sort's limit to limit + offset. So every row before the offset still reaches the receiver's queues, and both parts were short by that many rows. Size them from the child's cardinality instead, which is what the senders put on the wire. Not the filtered cardinality: this estimate bounds what the receiver can buffer, and a runtime filter that arrives late or does not select still leaves the full stream in the queues. When the child's estimate is unknown the senders still stop after limit + offset rows, and that is the bound to fall back to. card-limit-offset.test now runs with VALIDATE_RESOURCES, which compares the resource lines its queries already printed. Its three merging exchanges move: 37.76KB to 54.75KB, 16.00KB to 27.56KB, and 16.00KB to 55.01KB for OFFSET without a LIMIT, where the sender-side sort keeps no limit at all and the estimate has to cover the whole 7.30K-row input. Two older gaps in the same estimate are left alone and tracked in IMPALA-15326: the queue term divides by getNumNodes(), which on an exchange is the sender count rather than the number of receivers, and a limit that applies per instance is counted once for the whole fragment. Testing: - PlannerTest#testOffsetCardinality, and the same file with the fix reverted, which fails on all three merging exchanges - TpcdsPlannerTest, TpcdsCpuCostPlannerTest and TpcdsTupleCachePlannerTest: their 322 expected files come out byte-identical to the ones master produces, including the two ddl.test files that carry an offset Change-Id: I4ab880549e63267f97b2c193cf76aa92bbfc581c Assisted-by: Claude Opus 5 (Claude Code) Reviewed-on: https://gerrit.cloudera.org/24784 Reviewed-by: Quanlong Huang <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Reviewed-by: Csaba Ringhofer <[email protected]> --- M fe/src/main/java/org/apache/impala/planner/ExchangeNode.java M fe/src/test/java/org/apache/impala/planner/PlannerTest.java M testdata/workloads/functional-planner/queries/PlannerTest/card-limit-offset.test 3 files changed, 74 insertions(+), 18 deletions(-) Approvals: Quanlong Huang: Looks good to me, but someone else must approve Impala Public Jenkins: Verified Csaba Ringhofer: Looks good to me, approved -- To view, visit https://gerrit.cloudera.org/24784 To unsubscribe, visit https://gerrit.cloudera.org/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I4ab880549e63267f97b2c193cf76aa92bbfc581c Gerrit-Change-Number: 24784 Gerrit-PatchSet: 5 Gerrit-Owner: Aleksandr Efimov <[email protected]> Gerrit-Reviewer: Aleksandr Efimov <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]>
