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

Use materialization for scan-project-sort query

    XMLWordPrintableJSON

Details

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

    Description

      If a materialization is defined for scan-project-sort over another table, then scan-project and scan-project-sort queries should be able to use it.

      For example, given the following schema (in pseudo-DDL):

      CREATE TABLE Emp (empid, deptno, gender);
      CREATE MATERIALIZATION I_Emp_Deptno AS
        SELECT deptno, empid FROM Emp ORDER BY deptno;
      

      Calcite should rewrite the query

      SELECT deptno FROM Emp ORDER BY deptno

      to

      Project(deptno)
        TableScan(table=[I_Emp_Deptno])
      

      Note that no sort is necessary.

      This rewrite is important for using secondary indexes.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              julianhyde Julian Hyde
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 40m
                  1h 40m