Skip to content

Commit 2397401

Browse files
committed
Fix merge
1 parent 78c3961 commit 2397401

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/HiveResultSuite.scala

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,27 @@
1717

1818
package org.apache.spark.sql.execution
1919

20+
import java.sql.{Date, Timestamp}
21+
2022
import org.apache.spark.SparkFunSuite
21-
import org.apache.spark.sql.test.{ExamplePoint, ExamplePointUDT}
23+
import org.apache.spark.sql.test.{ExamplePoint, ExamplePointUDT, SharedSQLContext}
24+
25+
class HiveResultSuite extends SparkFunSuite with SharedSQLContext {
26+
import testImplicits._
2227

23-
class HiveResultSuite extends SparkFunSuite {
28+
test("date formatting in hive result") {
29+
val date = "2018-12-28"
30+
val executedPlan = Seq(Date.valueOf(date)).toDS().queryExecution.executedPlan
31+
val result = HiveResult.hiveResultString(executedPlan)
32+
assert(result.head == date)
33+
}
34+
35+
test("timestamp formatting in hive result") {
36+
val timestamp = "2018-12-28 01:02:03"
37+
val executedPlan = Seq(Timestamp.valueOf(timestamp)).toDS().queryExecution.executedPlan
38+
val result = HiveResult.hiveResultString(executedPlan)
39+
assert(result.head == timestamp)
40+
}
2441

2542
test("toHiveString correctly handles UDTs") {
2643
val point = new ExamplePoint(50.0, 50.0)

0 commit comments

Comments
 (0)