Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/6141#discussion_r31379184
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicOperators.scala
---
@@ -34,6 +35,32 @@ case class Project(projectList: Seq[NamedExpression],
child: LogicalPlan) extend
!expressions.exists(!_.resolved) && childrenResolved &&
!hasSpecialExpressions
}
+
+ /**
+ * Attempt to resolve an ambiguous attribute resolution.
+ * e.g. df1.join(df2, df1("key") === df2("key")).select("key")
+ *
+ * @param name name of the attribute which is ambiguous
+ * @param resolver resolver for comparing attributes
+ * @param ambiguousReferences the references which matched the name
+ * @return Some([[NamedExpression]]) if the ambiguity can be resolved,
otherwise None
+ */
+ override protected def resolveAmbiguous(
+ name: String,
+ resolver: Resolver,
+ ambiguousReferences: Seq[(Attribute, List[String])]):
Option[NamedExpression] =
+ this.child match {
+
+ // case where select is from an inner join where join keys resolve
to the same string
+ case _ @ Join(_,_,Inner,Some(EqualTo(leftExpr:NamedExpression,
rightExpr:NamedExpression)))
--- End diff --
This is too promising, what if something like `t1.a = t2.a and t1.c > 1`?
---
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]