Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-16824 FLIP-132 Temporal Table DDL and Temporal Table Join
  3. FLINK-15366

Improve FlinkCalcMergeRule to merge calc nodes better

    XMLWordPrintableJSON

Details

    Description

      FlinkCalcMergeRule should merge calc nodes when outer calc do not contains inner calc's fields, the following logical plan can not merge as expected currently:

      FlinkLogicalJoin(condition=[AND(=($0, $4), >($1, 1))], joinType=[left])
            :- FlinkLogicalCalc(select=[id, len, content], where=[>(id, 1)])
            :  +- FlinkLogicalTableSourceScan(table=[[default_catalog, default_database, T]], fields=[id, len, content])
            +- FlinkLogicalSnapshot(period=[$cor0.proctime])
               +- FlinkLogicalCalc(select=[age, id, name], where=[AND(>(age, 20), =(name, _UTF-16LE'Fabian':VARCHAR(2147483647) CHARACTER SET "UTF-16LE"))])
                  +- FlinkLogicalCalc(select=[age, id, name, PROCTIME() AS proctime])
                     +- FlinkLogicalTableSourceScan(table=[[default_catalog, default_database, userTable]], fields=[age, id, name])
      

      The corresponding SQL to reproduce this issue:

       CREATE TABLE userTable (
             `id` BIGINT,
             `len` BIGINT,
             `content` STRING,
             `proctime` AS PROCTIME()
             ) WITH (
             'connector' = 'values',
             'data-id' = '$dataId',
             'bounded' = 'true'
       )
      
      SELECT T.id, T.len, T.content, D.name FROM T JOIN userTable " +
        "for system_time as of T.proctime AS D ON T.id = D.id
      
      

       

      Attachments

        Issue Links

          Activity

            People

              leonard Leonard Xu
              leonard Leonard Xu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: