Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-5266

Eagerly project unused fields when selecting aggregation fields

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.0
    • Table SQL / API
    • None

    Description

      When we call table's select method and if it contains some aggregations, we will project fields after the aggregation. Would be better to project unused fields before the aggregation, and can furthermore leave the opportunity to push the project into scan.

      For example, the current logical plan of a simple query:

      table.select('a.sum as 's, 'a.max)
      

      is

      LogicalProject(s=[$0], TMP_2=[$1])
        LogicalAggregate(group=[{}], TMP_0=[SUM($5)], TMP_1=[MAX($5)])
          LogicalTableScan(table=[[supplier]])
      

      Would be better if we can project unused fields right after scan, and looks like this:

      LogicalProject(s=[$0], EXPR$1=[$0])
        LogicalAggregate(group=[{}], EXPR$1=[SUM($0)])
          LogicalProject(a=[$5])
            LogicalTableScan(table=[[supplier]])
      

      Attachments

        Issue Links

          Activity

            People

              ykt836 Kurt Young
              ykt836 Kurt Young
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: