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

             Summary: COMPUTE_PROCESSING_COST can plan more than one instance 
for an unpartitioned fragment
                 Key: IMPALA-15855
                 URL: https://issues.apache.org/jira/browse/IMPALA-15855
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
            Reporter: Zoltán Borók-Nagy


With COMPUTE_PROCESSING_COST=true, PlanFragment.adjustToMaxParallelism() has no 
case for UNPARTITIONED fragments. Only sinks that call setFixedInstanceCount(), 
such as PlanRootSink, fix the count at 1; other unpartitioned fragments are 
sized like partitioned ones, from their cost and PROCESSING_COST_MIN_THREADS, 
or for a union from the counts of their inputs. The scheduler runs an 
unpartitioned fragment as one instance, but the planner counts the larger 
number in the core count, uses it as the producer instance count in 
CostingSegment.tryAdjustParallelism() of the consuming fragment, and sends it 
to the backend as effective_instance_count. EXPLAIN shows instances=1, because 
getNumInstances() returns 1 for unpartitioned fragments. In addition, 
CostingSegment.createCoreCount() counts every union fragment at the 
max-parallelism of its inputs for cores_required_unbounded, an unpartitioned 
one included.

Example on master: PlannerTest#testProcessingCost sets 
PROCESSING_COST_MIN_THREADS=2 and plans the IMPALA-14006 regression query of 
tpcds-processing-cost.test with MAX_FRAGMENT_INSTANCES_PER_NODE=2:
{code:sql}
select timestamp_col, rank
from functional.alltypessmall alts
  left outer join (
    select id, dense_rank() over(order by id) as rank, int_col from 
functional.alltypes
  ) rank_view on (rank_view.id = alts.id)
where rank < 10;
{code}
The unpartitioned fragment F01 shows max-parallelism=1 and instances=1, but 
counts as 2: the root fragment F04 shows cpu-comparison-result=8 with 5 (self), 
which is 1 for F04, 2 for F03 and 2 for F01. In TpcdsCpuCostPlannerTest q49, 
the unpartitioned root fragment F18 holds 00:UNION and counts as 10 for 
cores_required_unbounded, the max-parallelism of its inputs, instead of 1.

Fix: fix the instance count of unpartitioned fragments at 1 in 
adjustToMaxParallelism(), and count an unpartitioned union fragment as 1 in 
createCoreCount().



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

Reply via email to