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

MaterializationService#defineMaterialization loses information on unique keys

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.21.0
    • None
    • core
    • None

    Description

      The impacted test is testAggregateMaterializationOnCountDistinctQuery1

      The test defines materialized view for the following SQL:

      select deptno, empid, salary from emps group by deptno, empid, salary

      In practice, the optimizer might be able to tell that empid is a unique key, thus it could understand the grouping is not needed.
      However, when it defines a materialized view, it loses uniqueness information, so it declares the view as

      select deptno, empid, salary from emps

      and the uniqueness is not there.

      org.apache.calcite.materialize.MaterializationService.DefaultTableFactory should probably compute metadata (e.g. unique keys, something else?) and propagate it to the materialized view.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vladimirsitnikov Vladimir Sitnikov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: