Skip to content

Commit 12b4239

Browse files
committed
improve test case
1 parent 08aee30 commit 12b4239

File tree

5 files changed

+3
-16
lines changed

5 files changed

+3
-16
lines changed

sql/hive/src/test/resources/golden/timestamp cast #3-0-dce645ca43d2bf888c4d75c456e42f3

Whitespace-only changes.

sql/hive/src/test/resources/golden/timestamp cast #3-1-732ed232ac592c5e7f7c913a88874fd2

Lines changed: 0 additions & 1 deletion
This file was deleted.

sql/hive/src/test/resources/golden/timestamp cast #4-0-dce645ca43d2bf888c4d75c456e42f3

Whitespace-only changes.

sql/hive/src/test/resources/golden/timestamp cast #4-1-6d2da5cfada03605834e38bc4075bc79

Lines changed: 0 additions & 1 deletion
This file was deleted.

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ class HiveQuerySuite extends HiveComparisonTest with SQLTestUtils with BeforeAnd
205205
|IF(FALSE, CAST(NULL AS DECIMAL), CAST(1 AS DECIMAL)) AS COL22,
206206
|IF(TRUE, CAST(NULL AS DECIMAL), CAST(1 AS DECIMAL)) AS COL23
207207
|FROM src LIMIT 1""".stripMargin)
208+
208209
test("constant null testing timestamp") {
209210
var r1 = sql(
210211
"""
@@ -563,24 +564,12 @@ class HiveQuerySuite extends HiveComparisonTest with SQLTestUtils with BeforeAnd
563564
assert(-1 == res.get(0))
564565
}
565566

566-
createQueryTest("timestamp cast #3",
567-
"""
568-
|set spark.sql.legacy.allowCastNumericToTimestamp=true;
569-
|SELECT CAST(CAST(1.2 AS TIMESTAMP) AS DOUBLE) FROM src LIMIT 1
570-
""".stripMargin)
571-
572-
createQueryTest("timestamp cast #4",
573-
"""
574-
|set spark.sql.legacy.allowCastNumericToTimestamp=true;
575-
|SELECT CAST(CAST(-1.2 AS TIMESTAMP) AS DOUBLE) FROM src LIMIT 1
576-
""".stripMargin)
577-
578-
test("timestamp cast #5") {
567+
test("timestamp cast #3") {
579568
val res = sql("SELECT CAST(TIMESTAMP_SECONDS(1200) AS INT) FROM src LIMIT 1").collect().head
580569
assert(1200 == res.getInt(0))
581570
}
582571

583-
test("timestamp cast #6") {
572+
test("timestamp cast #4") {
584573
val res = sql("SELECT CAST(TIMESTAMP_SECONDS(-1200) AS INT) FROM src LIMIT 1").collect().head
585574
assert(-1200 == res.getInt(0))
586575
}

0 commit comments

Comments
 (0)