Skip to content
Snippets Groups Projects
Commit 25b71d8c authored by Volodymyr Lyubinets's avatar Volodymyr Lyubinets Committed by Reynold Xin
Browse files

[SPARK-6296] [SQL] Added equals to Column

Author: Volodymyr Lyubinets <vlyubin@gmail.com>

Closes #4988 from vlyubin/columncomp and squashes the following commits:

92d7c8f [Volodymyr Lyubinets] Added equals to Column
parent e921a665
No related branches found
No related tags found
No related merge requests found
...@@ -59,6 +59,13 @@ class Column(protected[sql] val expr: Expression) { ...@@ -59,6 +59,13 @@ class Column(protected[sql] val expr: Expression) {
override def toString: String = expr.prettyString override def toString: String = expr.prettyString
override def equals(that: Any) = that match {
case that: Column => that.expr.equals(this.expr)
case _ => false
}
override def hashCode: Int = this.expr.hashCode
/** /**
* Unary minus, i.e. negate the expression. * Unary minus, i.e. negate the expression.
* {{{ * {{{
......
...@@ -313,4 +313,9 @@ class ColumnExpressionSuite extends QueryTest { ...@@ -313,4 +313,9 @@ class ColumnExpressionSuite extends QueryTest {
test("lift alias out of cast") { test("lift alias out of cast") {
assert(col("1234").as("name").cast("int").expr === col("1234").cast("int").as("name").expr) assert(col("1234").as("name").cast("int").expr === col("1234").cast("int").as("name").expr)
} }
test("columns can be compared") {
assert('key.desc == 'key.desc)
assert('key.desc != 'key.asc)
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment