aboutsummaryrefslogtreecommitdiff
path: root/sql/catalyst
diff options
context:
space:
mode:
authorReynold Xin <rxin@databricks.com>2015-05-05 18:59:46 -0700
committerMichael Armbrust <michael@databricks.com>2015-05-05 18:59:46 -0700
commit1fd31ba08928f8554f74609f48f4344bd69444e5 (patch)
tree777d86bc5743dba1eb0cb3e9850e172497f1d340 /sql/catalyst
parent0092abb47a0f9fdc716d5dfc1c591ddb45de8c98 (diff)
downloadspark-1fd31ba08928f8554f74609f48f4344bd69444e5.tar.gz
spark-1fd31ba08928f8554f74609f48f4344bd69444e5.tar.bz2
spark-1fd31ba08928f8554f74609f48f4344bd69444e5.zip
[SPARK-6231][SQL/DF] Automatically resolve join condition ambiguity for self-joins.
See the comment in join function for more information. Author: Reynold Xin <rxin@databricks.com> Closes #5919 from rxin/self-join-resolve and squashes the following commits: e2fb0da [Reynold Xin] Updated SQLConf comment. 7233a86 [Reynold Xin] Updated comment. 6be2b4d [Reynold Xin] Removed println 9f6b72f [Reynold Xin] [SPARK-6231][SQL/DF] Automatically resolve ambiguity in join condition for self-joins.
Diffstat (limited to 'sql/catalyst')
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala
index afcb2ce8b9..57ace2a14f 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala
@@ -171,6 +171,11 @@ case class AttributeReference(
val exprId: ExprId = NamedExpression.newExprId,
val qualifiers: Seq[String] = Nil) extends Attribute with trees.LeafNode[Expression] {
+ /**
+ * Returns true iff the expression id is the same for both attributes.
+ */
+ def sameRef(other: AttributeReference): Boolean = this.exprId == other.exprId
+
override def equals(other: Any): Boolean = other match {
case ar: AttributeReference => name == ar.name && exprId == ar.exprId && dataType == ar.dataType
case _ => false