Vladimir Sitnikov created CALCITE-3682:
------------------------------------------

             Summary: MaterializationService#defineMaterialization loses 
information on unique keys
                 Key: CALCITE-3682
                 URL: https://issues.apache.org/jira/browse/CALCITE-3682
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.21.0
            Reporter: Vladimir Sitnikov


The impacted test is testAggregateMaterializationOnCountDistinctQuery1

The test defines materialized view for the following SQL:
{code:sql}select deptno, empid, salary from emps group by deptno, empid, 
salary{code}

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

{code:sql}select deptno, empid, salary from emps{code}
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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to