Class PushWatermarkIntoTableSourceScanRuleBase

java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.flink.table.planner.plan.rules.logical.PushWatermarkIntoTableSourceScanRuleBase
Direct Known Subclasses:
PushWatermarkIntoTableSourceScanAcrossCalcRule, PushWatermarkIntoTableSourceScanRule

public abstract class PushWatermarkIntoTableSourceScanRuleBase extends org.apache.calcite.plan.RelOptRule
Base rule for interface SupportsWatermarkPushDown and SupportsSourceWatermark. It offers a util to push the FlinkLogicalWatermarkAssigner into the FlinkLogicalTableSourceScan.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.calcite.plan.RelOptRule

    org.apache.calcite.plan.RelOptRule.ConverterRelOptRuleOperand
  • Field Summary

    Fields inherited from class org.apache.calcite.plan.RelOptRule

    description, operands, relBuilderFactory
  • Constructor Summary

    Constructors
    Constructor
    Description
    PushWatermarkIntoTableSourceScanRuleBase(org.apache.calcite.plan.RelOptRuleOperand operand, String description)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected FlinkLogicalTableSourceScan
    getNewScan(FlinkLogicalWatermarkAssigner watermarkAssigner, org.apache.calcite.rex.RexNode watermarkExpr, FlinkLogicalTableSourceScan scan, org.apache.flink.table.api.TableConfig tableConfig, boolean useWatermarkAssignerRowType)
    It uses the input watermark expression to generate the WatermarkGeneratorSupplier.
    protected boolean
    supportsWatermarkPushDown(FlinkLogicalTableSourceScan scan)
     

    Methods inherited from class org.apache.calcite.plan.RelOptRule

    any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, onMatch, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PushWatermarkIntoTableSourceScanRuleBase

      public PushWatermarkIntoTableSourceScanRuleBase(org.apache.calcite.plan.RelOptRuleOperand operand, String description)
  • Method Details

    • getNewScan

      protected FlinkLogicalTableSourceScan getNewScan(FlinkLogicalWatermarkAssigner watermarkAssigner, org.apache.calcite.rex.RexNode watermarkExpr, FlinkLogicalTableSourceScan scan, org.apache.flink.table.api.TableConfig tableConfig, boolean useWatermarkAssignerRowType)
      It uses the input watermark expression to generate the WatermarkGeneratorSupplier. After the WatermarkStrategy is pushed into the scan, it will build a new scan. However, when FlinkLogicalWatermarkAssigner is the parent of the FlinkLogicalTableSourceScan it should modify the rowtime type to keep the type of plan is consistent. In other cases, it just keep the data type of the scan as same as before and leave the work when rewriting the projection.

      NOTES: the row type of the scan is not always as same as the watermark assigner. Because the scan will not add the rowtime column into the row when pushing the watermark assigner into the scan. In some cases, query may have computed columns defined on rowtime column. If modifying the type of the rowtime(with time attribute), it will also influence the type of the computed column. Therefore, if the watermark assigner is not the parent of the scan, set the type of the scan as before and leave the work to projection.

    • supportsWatermarkPushDown

      protected boolean supportsWatermarkPushDown(FlinkLogicalTableSourceScan scan)