Laurent Goujon created CALCITE-2538:
---------------------------------------

             Summary: Missing RelMetadataQuery invalidation before subset cost 
improvement propagation
                 Key: CALCITE-2538
                 URL: https://issues.apache.org/jira/browse/CALCITE-2538
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Laurent Goujon
            Assignee: Julian Hyde


When planner log level is set to debug, several tests are failing with the 
following error message:
{noformat}
rel 
[rel#11408:EnumerableProject.ENUMERABLE.[](input=rel#11180:Subset#2.ENUMERABLE.[0],DUMMY=0)]
 has lower cost {24.5 rows, 39.5 cpu, 0.0 io} than best cost {28.0 rows, 36.0 
cpu, 0.0 io} of subset [rel#11177:Subset#3.ENUMERABLE.[]]
{noformat}

The following query (from 'sql/agg.iq') should exhibit the issue:
{code:sql}
select sum(e.sal) as s from "scott".emp e join "scott".emp m on e.mgr = e.empno;
{code}

I tried to trace it back and my understanding is that during cost improvement 
propagation, a subset has its cost/best node changed, and it triggers 
recomputing the cost of the parent subset, but the current best node of the 
parent has its value cached in the current rel metadata query, and is not 
recomputed. During a later validation, this error is detected and the assertion 
is thrown.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to