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

Avoid treating Project(x=1) and Project(x=1) equal in case the type of 1 is int in the first rel and long in the second one

    XMLWordPrintableJSON

Details

    Description

      After CALCITE-2116, a RelNode will be reused based on digest, but now many nodes's digests do not have type info, e.g. LogicalProject, this will affect some rules when we wanna transform to a node with same digest and same type (HepPlanner may pick out a RelNode with different type).

      So, we should add type info just like VolcanoPlanner.

      We encounter this problem with plan like below:

      Union
      +-- project1(a: int, b:int, c: double)
      | +-- project2(a: bigint: b: int, c:double)
      +-- project3
      

      We wanna cast a from bigint -> int so we can have a union with project1 and project3, but with ProjectMergeRule, while merging project1 and project2, HepPlanner will think project2 and project1 are identical and it gives back project2. But actually we wanna pick project1.

      Attachments

        1. project_with_literals_digest.png
          265 kB
          Vladimir Sitnikov
        2. expr_types.png
          214 kB
          Vladimir Sitnikov

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              danny0405 Danny Chen
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: