Zoltán Borók-Nagy created IMPALA-15854:
------------------------------------------

             Summary: COMPUTE_PROCESSING_COST costing segments report the input 
rows of their last appended node as produced rows
                 Key: IMPALA-15854
                 URL: https://issues.apache.org/jira/browse/IMPALA-15854
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
            Reporter: Zoltán Borók-Nagy


CostingSegment.appendCost() sets the rows a segment produces to 
additionalCost.getNumRowToConsume(), the input rows of the appended node, 
instead of getNumRowToProduce(). A segment that ends in an aggregation appended 
above an exchange or a join therefore reports the aggregation's input as its 
output. Step 2 of PlanFragment.traverseEffectiveParallelism() uses that segment 
as the producer of the next segment in the fragment, and 
ProcessingCost.consumerProducerRatio() divides by its cost per produced row, so 
the next segment is sized against the wrong row stream. Segments that end in a 
DataSink are not affected.

Examples on master from TpcdsCpuCostPlannerTest (TPC-DS 3TB stats, 10 
executors, MAX_FRAGMENT_INSTANCES_PER_NODE=12). In tpcds-q43-verbose.test, 
added by IMPALA-13119 to check these counts, the F03 segment that ends in 
10:AGGREGATE shows #cons:#prod=162000:162000, while the aggregation itself 
shows 162000:1350. In q59 the merge aggregations 20:AGGREGATE in F02 and 
25:AGGREGATE in F07 read 833.88M rows and return 6.95M; the segment above each 
is compared against a producer cost per row of 2.5 instead of 299, which keeps 
both fragments at 120 instances where the produced rows would give 40. In q18 
the error goes the other way: the rollup preaggregation 13:AGGREGATE in F06 
reads 6.14M rows and returns 22.89M, so F06 and its join build F13 are lowered 
to 40 instances instead of staying at their max-parallelism of 110.

Fix: take the produced rows from the appended node, 
additionalCost.getNumRowToProduce(), and update the planner test expectations.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to