Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2538

Missing RelMetadataQuery invalidation before subset cost improvement propagation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 1.18.0
    • Component/s: core
    • Labels:
      None

      Description

      When planner log level is set to debug, several tests are failing with the following error message:

      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.[]]
      

      The following query (from 'sql/agg.iq') should exhibit the issue:

      select sum(e.sal) as s from "scott".emp e join "scott".emp m on e.mgr = e.empno;
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                laurent Laurent Goujon
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: