Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8889#discussion_r40339049
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/LogicalRelation.scala
 ---
    @@ -17,23 +17,44 @@
     package org.apache.spark.sql.execution.datasources
     
     import org.apache.spark.sql.catalyst.analysis.MultiInstanceRelation
    -import org.apache.spark.sql.catalyst.expressions.{AttributeMap, 
AttributeReference}
    +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeMap, 
AttributeReference}
     import org.apache.spark.sql.catalyst.plans.logical.{LeafNode, LogicalPlan, 
Statistics}
     import org.apache.spark.sql.sources.BaseRelation
     
     /**
      * Used to link a [[BaseRelation]] in to a logical query plan.
    + *
    + * Note that sometimes we need to use `LogicalRelation` to replace an 
existing leaf node without
    + * changing the output attributes' IDs.  The `expectedOutputAttributes` 
parameter is used for
    + * this purpose.
      */
    -private[sql] case class LogicalRelation(relation: BaseRelation)
    -  extends LeafNode
    -  with MultiInstanceRelation {
    +private[sql] case class LogicalRelation(
    +    relation: BaseRelation,
    +    expectedOutputAttributes: Seq[Attribute] = Nil)
    --- End diff --
    
    Can we use `Option[Seq[Attribute]]`? I think the semantic of having a 
`Option` at here is more clearer than just using a `Seq` and the meaning of it 
is self-explanatory. `None` means that `expectedOutputAttributes` is not 
defined.
    
    If we use `Seq`, `Nil` does not necessarily mean that 
`expectedOutputAttributes` is not defined. Without other comments, it can mean 
that we have defined `expectedOutputAttributes` and it is a `Nil`. Readers have 
to take a look at our comments to understand its meaning.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to