File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
sql/core/src/test/scala/org/apache/spark/sql/execution Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 17
17
18
18
package org .apache .spark .sql .execution
19
19
20
+ import java .sql .{Date , Timestamp }
21
+
20
22
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 ._
22
27
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
+ }
24
41
25
42
test(" toHiveString correctly handles UDTs" ) {
26
43
val point = new ExamplePoint (50.0 , 50.0 )
You can’t perform that action at this time.
0 commit comments