Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/3269#discussion_r101755176 --- 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 -- I think it would be nice, if we would go deeper than just one level.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---