flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wuchong <...@git.apache.org>
Subject [GitHub] flink pull request #3269: [FLINK-5698] Add NestedFieldsProjectableTableSourc...
Date Sat, 18 Feb 2017 07:52:40 GMT
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.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message