cloud-fan commented on a change in pull request #34712:
URL: https://github.com/apache/spark/pull/34712#discussion_r756885053



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/orc/OrcQuerySuite.scala
##########
@@ -830,6 +830,27 @@ abstract class OrcQuerySuite extends OrcQueryTest with 
SharedSparkSession {
       }
     }
   }
+
+  test("SPARK-37463: read/write Timestamp ntz or ltz to Orc uses UTC 
timestamp") {
+    TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"))
+    sql("set spark.sql.session.timeZone = America/Los_Angeles")
+
+    val df =
+      sql("select timestamp_ntz '2021-06-01 00:00:00' ts_ntz, timestamp 
'2021-06-01 00:00:00' ts")
+
+    df.write.mode("overwrite").orc("ts_ntz_orc")
+    df.write.mode("overwrite").parquet("ts_ntz_parquet")
+
+    val queryOrc = "select * from `orc`.`ts_ntz_orc`"
+    val queryParquet = "select * from `parquet`.`ts_ntz_parquet`"
+
+    val tzs = Seq("America/Los_Angeles", "UTC", "Europe/Amsterdam")
+    for (tz <- tzs) {
+      TimeZone.setDefault(TimeZone.getTimeZone(tz))
+      sql(s"set spark.sql.session.timeZone = $tz")
+      sql(queryOrc).collect().equals(sql(queryParquet).collect())

Review comment:
       let's test with `withAllOrcReaders`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to