Class ScanReuserUtils
- java.lang.Object
-
- org.apache.flink.table.planner.plan.reuse.ScanReuserUtils
-
public class ScanReuserUtils extends Object
Utils forScanReuser
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<SourceAbilitySpec>
abilitySpecsWithoutEscaped(org.apache.flink.table.planner.plan.schema.TableSourceTable table)
Returns a list ofSourceAbilitySpec
instances associated with a givenTableSourceTable
instance, excluding some particular abilities, such asProjectPushDownSpec
.static int[][]
concatProjectedFields(ResolvedSchema schema, RowType originType, int[][] physicalFields, List<String> metaKeys)
static boolean
containsRexNodeSpecAfterProjection(org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalTableSourceScan table)
ContainsSourceAbilitySpec.needAdjustFieldReferenceAfterProjection()
spec after projection push down exceptWatermarkPushDownSpec
.static org.apache.calcite.rel.core.Calc
createCalcForScan(org.apache.calcite.rel.RelNode input, org.apache.calcite.rex.RexProgram program)
static <T extends SourceAbilitySpec>
TgetAbilitySpec(SourceAbilitySpec[] abilitySpecs, Class<T> specClass)
static Optional<WatermarkPushDownSpec>
getAdjustedWatermarkSpec(org.apache.flink.table.planner.plan.schema.TableSourceTable table, RowType oldSourceType, RowType newSourceType)
Watermark push down must be after projection push down, so we need to adjust its index.static String
getDigest(org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalTableSourceScan scan, boolean withoutEscape)
Get the digest ofCommonPhysicalTableSourceScan
, which ignoring certainSourceAbilitySpec
.static int
indexOf(int[][] projectedFields, int[] fieldIndices)
Found the index of specific projected field in the nested array which is made up of all projected fields index paths.static boolean
isEscapeDigest(SourceAbilitySpec spec)
static List<String>
metadataKeys(org.apache.flink.table.planner.plan.schema.TableSourceTable source)
static org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalTableSourceScan
pickScanWithWatermark(List<org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalTableSourceScan> scans)
static int[][]
projectedFields(org.apache.flink.table.planner.plan.schema.TableSourceTable source)
static boolean
reusableWithoutAdjust(List<? extends org.apache.calcite.rel.RelNode> reusableNodes)
-
-
-
Method Detail
-
indexOf
public static int indexOf(int[][] projectedFields, int[] fieldIndices)
Found the index of specific projected field in the nested array which is made up of all projected fields index paths.
-
abilitySpecsWithoutEscaped
public static List<SourceAbilitySpec> abilitySpecsWithoutEscaped(org.apache.flink.table.planner.plan.schema.TableSourceTable table)
Returns a list ofSourceAbilitySpec
instances associated with a givenTableSourceTable
instance, excluding some particular abilities, such asProjectPushDownSpec
. These abilities don't need before do scan reuse.
-
isEscapeDigest
public static boolean isEscapeDigest(SourceAbilitySpec spec)
-
containsRexNodeSpecAfterProjection
public static boolean containsRexNodeSpecAfterProjection(org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalTableSourceScan table)
ContainsSourceAbilitySpec.needAdjustFieldReferenceAfterProjection()
spec after projection push down exceptWatermarkPushDownSpec
. We have customized the solution for watermark push down.
-
getAdjustedWatermarkSpec
public static Optional<WatermarkPushDownSpec> getAdjustedWatermarkSpec(org.apache.flink.table.planner.plan.schema.TableSourceTable table, RowType oldSourceType, RowType newSourceType)
Watermark push down must be after projection push down, so we need to adjust its index.
-
createCalcForScan
public static org.apache.calcite.rel.core.Calc createCalcForScan(org.apache.calcite.rel.RelNode input, org.apache.calcite.rex.RexProgram program)
-
projectedFields
public static int[][] projectedFields(org.apache.flink.table.planner.plan.schema.TableSourceTable source)
-
metadataKeys
public static List<String> metadataKeys(org.apache.flink.table.planner.plan.schema.TableSourceTable source)
-
concatProjectedFields
public static int[][] concatProjectedFields(ResolvedSchema schema, RowType originType, int[][] physicalFields, List<String> metaKeys)
-
reusableWithoutAdjust
public static boolean reusableWithoutAdjust(List<? extends org.apache.calcite.rel.RelNode> reusableNodes)
-
getDigest
public static String getDigest(org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalTableSourceScan scan, boolean withoutEscape)
Get the digest ofCommonPhysicalTableSourceScan
, which ignoring certainSourceAbilitySpec
.- Parameters:
scan
- inputCommonPhysicalTableSourceScan
.withoutEscape
- Whether to include these escapeSourceAbilitySpec
s in returned digest.- Returns:
- the digest that ignore certain
SourceAbilitySpec
.
-
getAbilitySpec
public static <T extends SourceAbilitySpec> T getAbilitySpec(SourceAbilitySpec[] abilitySpecs, Class<T> specClass)
-
pickScanWithWatermark
public static org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalTableSourceScan pickScanWithWatermark(List<org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalTableSourceScan> scans)
-
-