Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/17552#discussion_r110287008
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/LogicalRelation.scala
---
@@ -18,39 +18,21 @@ package org.apache.spark.sql.execution.datasources
import org.apache.spark.sql.catalyst.analysis.MultiInstanceRelation
import org.apache.spark.sql.catalyst.catalog.CatalogTable
-import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeMap,
AttributeReference}
+import org.apache.spark.sql.catalyst.expressions.{AttributeMap,
AttributeReference}
import org.apache.spark.sql.catalyst.plans.logical.{LeafNode, LogicalPlan,
Statistics}
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.sources.BaseRelation
import org.apache.spark.util.Utils
/**
* 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. See https://issues.apache.org/jira/browse/SPARK-10741
for more details.
*/
case class LogicalRelation(
relation: BaseRelation,
- expectedOutputAttributes: Option[Seq[Attribute]] = None,
- catalogTable: Option[CatalogTable] = None)
+ output: Seq[AttributeReference],
+ catalogTable: Option[CatalogTable])
extends LeafNode with MultiInstanceRelation {
- override val output: Seq[AttributeReference] = {
- val attrs = relation.schema.toAttributes
- expectedOutputAttributes.map { expectedAttrs =>
- assert(expectedAttrs.length == attrs.length)
- attrs.zip(expectedAttrs).map {
- // We should respect the attribute names provided by base relation
and only use the
- // exprId in `expectedOutputAttributes`.
- // The reason is that, some relations(like parquet) will reconcile
attribute names to
- // workaround case insensitivity issue.
- case (attr, expected) => attr.withExprId(expected.exprId)
--- End diff --
It sounds like this logics mentioned in the comments is removed by this PR.
---
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]