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

    https://github.com/apache/spark/pull/8889#discussion_r40273351
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/LogicalRelation.scala
 ---
    @@ -17,23 +17,35 @@
     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.{ExprId, 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.  We can pass in the 
`expectedOutputIds` parameter for
    + * this purpose.
      */
    -private[sql] case class LogicalRelation(relation: BaseRelation)
    -  extends LeafNode
    -  with MultiInstanceRelation {
    +private[sql] final class LogicalRelation(val relation: BaseRelation, 
expectedOutputIds: Seq[ExprId])
    --- End diff --
    
    How about we use the following?
    ```
    private[sql] case class LogicalRelation(
        relation: BaseRelation,
        override val output: Seq[AttributeReference])
      extends LeafNode
      with MultiInstanceRelation {
    
      def this(relation: BaseRelation) = this(relation, 
relation.schema.toAttributes)
    ```


---
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