[
https://issues.apache.org/jira/browse/FLINK-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15873045#comment-15873045
]
ASF GitHub Bot commented on FLINK-5698:
---------------------------------------
Github user wuchong commented on a diff in the pull request:
https://github.com/apache/flink/pull/3269#discussion_r101887738
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/util/RexProgramProjectExtractor.scala
---
@@ -84,6 +105,39 @@ object RexProgramProjectExtractor {
}
/**
+ * A RexVisitor to extract used nested input fields
+ */
+class RefFieldAccessorVisitor(
+ usedFields: Array[Int],
+ names: List[String])
+ extends RexVisitorImpl[Unit](true) {
+
+ private val group = usedFields.toList
+ private var nestedFields = mutable.LinkedHashSet[String]()
+
+ def getNestedFields: Array[String] = nestedFields.toArray
+
+ override def visitFieldAccess(fieldAccess: RexFieldAccess): Unit = {
+ fieldAccess.getReferenceExpr match {
+ case ref: RexInputRef =>
+ nestedFields +=
s"${names(ref.getIndex)}.${fieldAccess.getField.getName}"
--- End diff --
Yes, the parent of `RexFieldAccess` can be also a `RexFieldAccess`. We
should take care of that.
> Add NestedFieldsProjectableTableSource interface
> ------------------------------------------------
>
> Key: FLINK-5698
> URL: https://issues.apache.org/jira/browse/FLINK-5698
> Project: Flink
> Issue Type: New Feature
> Components: Table API & SQL
> Reporter: Anton Solovev
> Assignee: Anton Solovev
>
> Add a NestedFieldsProjectableTableSource interface for some TableSource
> implementation that support nesting projection push-down.
> The interface could look as follows
> {code}
> def trait NestedFieldsProjectableTableSource {
> def projectNestedFields(fields: Array[String]):
> NestedFieldsProjectableTableSource[T]
> }
> {code}
> This interface works together with ProjectableTableSource
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)