aboutsummaryrefslogtreecommitdiff
path: root/sql/catalyst
diff options
context:
space:
mode:
authorLiang-Chi Hsieh <viirya@gmail.com>2015-05-14 20:49:21 -0700
committerReynold Xin <rxin@databricks.com>2015-05-14 20:49:21 -0700
commitf9705d461350c6fccf8022e933ea909f40c53576 (patch)
tree56fed3dd360e6bebf8e101e73385d63b90edcc32 /sql/catalyst
parent6d0633e3ec9518278fcc7eba58549d4ad3d5813f (diff)
downloadspark-f9705d461350c6fccf8022e933ea909f40c53576.tar.gz
spark-f9705d461350c6fccf8022e933ea909f40c53576.tar.bz2
spark-f9705d461350c6fccf8022e933ea909f40c53576.zip
[SPARK-7098][SQL] Make the WHERE clause with timestamp show consistent result
JIRA: https://issues.apache.org/jira/browse/SPARK-7098 The WHERE clause with timstamp shows inconsistent results. This pr fixes it. Author: Liang-Chi Hsieh <viirya@gmail.com> Closes #5682 from viirya/consistent_timestamp and squashes the following commits: 171445a [Liang-Chi Hsieh] Merge remote-tracking branch 'upstream/master' into consistent_timestamp 4e98520 [Liang-Chi Hsieh] Make the WHERE clause with timestamp show consistent result.
Diffstat (limited to 'sql/catalyst')
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
index 168a4e30ea..fe0d3f2997 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
@@ -251,10 +251,10 @@ trait HiveTypeCoercion {
p.makeCopy(Array(Cast(p.left, StringType), p.right))
case p: BinaryComparison if p.left.dataType == StringType &&
p.right.dataType == TimestampType =>
- p.makeCopy(Array(p.left, Cast(p.right, StringType)))
+ p.makeCopy(Array(Cast(p.left, TimestampType), p.right))
case p: BinaryComparison if p.left.dataType == TimestampType &&
p.right.dataType == StringType =>
- p.makeCopy(Array(Cast(p.left, StringType), p.right))
+ p.makeCopy(Array(p.left, Cast(p.right, TimestampType)))
case p: BinaryComparison if p.left.dataType == TimestampType &&
p.right.dataType == DateType =>
p.makeCopy(Array(Cast(p.left, StringType), Cast(p.right, StringType)))
@@ -274,7 +274,7 @@ trait HiveTypeCoercion {
i.makeCopy(Array(Cast(a, StringType), b))
case i @ In(a, b) if a.dataType == TimestampType &&
b.forall(_.dataType == StringType) =>
- i.makeCopy(Array(Cast(a, StringType), b))
+ i.makeCopy(Array(a, b.map(Cast(_, TimestampType))))
case i @ In(a, b) if a.dataType == DateType &&
b.forall(_.dataType == TimestampType) =>
i.makeCopy(Array(Cast(a, StringType), b.map(Cast(_, StringType))))