snuyanzin commented on code in PR #28556:
URL: https://github.com/apache/flink/pull/28556#discussion_r3494044607
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/PushFilterIntoSourceScanRuleBase.java:
##########
@@ -113,6 +114,82 @@ protected RexNode createRemainingCondition(
return new Tuple2<>(result, newTableSourceTable);
}
+ /**
+ * Classifies convertible predicates into physical and metadata, pushes
each through the
+ * appropriate path, and returns the updated table plus any remaining
predicates.
+ */
+ protected FilterClassificationResult classifyAndPushFilters(
+ RexNode[] convertiblePredicates,
+ TableSourceTable tableSourceTable,
+ TableScan scan,
+ RelBuilder relBuilder) {
+
+ boolean supportsPhysicalFilter = canPushdownFilter(tableSourceTable);
+ boolean supportsMetadataFilter =
canPushdownMetadataFilter(tableSourceTable);
+ Set<Integer> metadataColumnIndices =
metadataColumnIndices(tableSourceTable, scan);
+
+ List<RexNode> allRemainingRexNodes = new ArrayList<>();
+ TableSourceTable currentTable = tableSourceTable;
+
+ List<RexNode> physicalPredicates = new ArrayList<>();
+ List<RexNode> metadataPredicates = new ArrayList<>();
+ for (RexNode predicate : convertiblePredicates) {
+ if (referencesOnlyMetadataColumns(predicate,
metadataColumnIndices)) {
+ if (supportsMetadataFilter) {
+ metadataPredicates.add(predicate);
+ } else {
+ allRemainingRexNodes.add(predicate);
+ }
+ } else if (referencesAnyMetadataColumns(predicate,
metadataColumnIndices)) {
Review Comment:
why do we need to invoke same method 2 times per iteration if we could have
all the data after the first call?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]