MaxGekk opened a new pull request #28699:
URL: https://github.com/apache/spark/pull/28699


   ### What changes were proposed in this pull request?
   Fixed conversions of `java.sql.Timestamp` to milliseconds in `ParquetFilter` 
by using existing functions from `DateTimeUtils` `fromJavaTimestamp()` and 
`microsToMillis()`.
   
   ### Why are the changes needed?
   The changes fix the bug:
   ```scala
   scala> spark.conf.set("spark.sql.parquet.outputTimestampType", 
"TIMESTAMP_MILLIS")
   scala> spark.conf.set("spark.sql.legacy.parquet.datetimeRebaseModeInWrite", 
"CORRECTED")
   scala> Seq(java.sql.Timestamp.valueOf("1000-06-14 
08:28:53.123")).toDF("ts").write.mode("overwrite").parquet("/Users/maximgekk/tmp/ts_millis_old_filter")
   scala> 
spark.read.parquet("/Users/maximgekk/tmp/ts_millis_old_filter").filter($"ts" 
=== "1000-06-14 08:28:53.123").show(false)
   +---+
   |ts |
   +---+
   +---+
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, after the changes (for the example above):
   ```scala
   scala> 
spark.read.parquet("/Users/maximgekk/tmp/ts_millis_old_filter").filter($"ts" 
=== "1000-06-14 08:28:53.123").show(false)
   +-----------------------+
   |ts                     |
   +-----------------------+
   |1000-06-14 08:28:53.123|
   +-----------------------+
   ```
   
   ### How was this patch tested?
   Modified tests in `ParquetFilterSuite` to check old timestamps.


----------------------------------------------------------------
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]



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

Reply via email to