MaxGekk opened a new pull request #28047: [SPARK-31284][SQL][TESTS] Check 
rebasing of timestamps in ORC datasource
URL: https://github.com/apache/spark/pull/28047
 
 
   ### What changes were proposed in this pull request?
   In the PR, I propose 2 tests to check that rebasing of timestamps from/to 
the hybrid calendar (Julian + Gregorian) to/from Proleptic Gregorian calendar 
works correctly.
   1. The test `compatibility with Spark 2.4 in reading timestamps` load ORC 
file saved by Spark 2.4.5 via:
   ```shell
   $ export TZ="America/Los_Angeles"
   ```
   ```scala
   scala> spark.conf.set("spark.sql.session.timeZone", "America/Los_Angeles")
   
   scala> val df = Seq("1001-01-01 
01:02:03.123456").toDF("tsS").select($"tsS".cast("timestamp").as("ts"))
   df: org.apache.spark.sql.DataFrame = [ts: timestamp]
   
   scala> df.write.orc("/Users/maxim/tmp/before_1582/2_4_5_ts_orc")
   
   scala> 
spark.read.orc("/Users/maxim/tmp/before_1582/2_4_5_ts_orc").show(false)
   +--------------------------+
   |ts                        |
   +--------------------------+
   |1001-01-01 01:02:03.123456|
   +--------------------------+
   ```
   2. The test `rebasing timestamps in write` is round trip test. Since the 
previous test confirms correct rebasing of timestamps in read. This test should 
pass only if rebasing works correctly in write.
   
   ### Why are the changes needed?
   To guarantee that rebasing works correctly for timestamps in ORC datasource.
   
   ### Does this PR introduce any user-facing change?
   No
   
   ### How was this patch tested?
   By running `OrcSourceSuite` for Hive 1.2 and 2.3 via the commands:
   ```
   $ build/sbt -Phive-2.3 "test:testOnly *OrcSourceSuite"
   ```
   and
   ```
   $ build/sbt -Phive-1.2 "test:testOnly *OrcSourceSuite"
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to