walterddr commented on a change in pull request #8468:
[FLINK-12399][table][table-planner] Fix FilterableTableSource does not change
after applyPredicate
URL: https://github.com/apache/flink/pull/8468#discussion_r335181158
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/PushProjectIntoTableSourceScanRule.scala
##########
@@ -67,13 +67,23 @@ class PushProjectIntoTableSourceScanRule extends
RelOptRule(
val relOptTable = scan.getTable.asInstanceOf[FlinkRelOptTable]
val tableSourceTable = relOptTable.unwrap(classOf[TableSourceTable[_]])
val oldTableSource = tableSourceTable.tableSource
- val newTableSource = oldTableSource match {
+ val (newTableSource, isProjectSuccess) = oldTableSource match {
case nested: NestedFieldsProjectableTableSource[_] =>
val nestedFields = RexNodeExtractor.extractRefNestedInputFields(
project.getProjects, usedFields)
- nested.projectNestedFields(usedFields, nestedFields)
+ (nested.projectNestedFields(usedFields, nestedFields), true)
case projecting: ProjectableTableSource[_] =>
- projecting.projectFields(usedFields)
+ (projecting.projectFields(usedFields), true)
+ case nonProjecting: TableSource[_] =>
+ // projection cannot be pushed to TableSource
+ (nonProjecting, false)
+ }
+
+ if (isProjectSuccess
+ &&
newTableSource.explainSource().equals(oldTableSource.explainSource())) {
Review comment:
I think the special case can be put outside of the scope of this PR since it
is more related to how `*` is handled. I can open another JIRA for addressing
this. what do you think?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services