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

Push projections through Aggregate to CsvTableScan

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.15.0
    • Component/s: csv-adapter
    • Labels:
      None

      Description

      Create a rule to push the projections used in aggregate functions. From Julian Hyde:

      Calcite should realize that Aggregate has an implied Project (because it only uses a few columns) and push that projection into the CsvTableScan, but it doesn’t.

      A query scans only the used projection when no aggregation is used:

      explain plan for select name from emps;
      
      CsvTableScan(table=[[SALES, EMPS]], fields=[[1]])
      

      But it scans all the projections when an aggregation is used:

      explain plan for select max(name) from emps;
      
      EnumerableAggregate(group=[{}], EXPR$0=[MAX($1)])
        CsvTableScan(table=[[SALES, EMPS]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]])
      

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              lfkauer Luis Fernando Kauer
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: