aboutsummaryrefslogtreecommitdiff
path: root/sql/core
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/core
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/core')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala4
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/TestData.scala2
2 files changed, 5 insertions, 1 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
index 8cdbe076cb..479ad9fe62 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
@@ -298,6 +298,10 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
test("SPARK-3173 Timestamp support in the parser") {
checkAnswer(sql(
+ "SELECT time FROM timestamps WHERE time='1969-12-31 16:00:00.0'"),
+ Row(java.sql.Timestamp.valueOf("1969-12-31 16:00:00")))
+
+ checkAnswer(sql(
"SELECT time FROM timestamps WHERE time=CAST('1969-12-31 16:00:00.001' AS TIMESTAMP)"),
Row(java.sql.Timestamp.valueOf("1969-12-31 16:00:00.001")))
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/TestData.scala b/sql/core/src/test/scala/org/apache/spark/sql/TestData.scala
index 446771ab2a..8fbc2d23d4 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/TestData.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/TestData.scala
@@ -175,7 +175,7 @@ object TestData {
"4, D4, true, 2147483644" :: Nil)
case class TimestampField(time: Timestamp)
- val timestamps = TestSQLContext.sparkContext.parallelize((1 to 3).map { i =>
+ val timestamps = TestSQLContext.sparkContext.parallelize((0 to 3).map { i =>
TimestampField(new Timestamp(i))
})
timestamps.toDF().registerTempTable("timestamps")