tianhanhu-db commented on code in PR #40678:
URL: https://github.com/apache/spark/pull/40678#discussion_r1160376168
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala:
##########
@@ -98,6 +100,14 @@ private object PostgresDialect extends JdbcDialect with
SQLConfHelper {
case _ => None
}
+ override def convertJavaTimestampToTimestampNTZ(t: Timestamp): Long = {
+ DateTimeUtils.localDateTimeToMicros(t.toLocalDateTime)
Review Comment:
I tried the Postgres specific solution for the existing H2 test and it is
not working.
I checked H2 driver as well and I think what happens is that H2 is creating
the timestamp using the the milliseconds from epoch and THEN converting the
wall clock time to the represent the instant in local Timezone. This change in
order makes the difference. If we take the previous case as an example, the
resultant Timestamp would be "2023-04-05 01:00:00 America/Los_Angeles". This
represent the same instant as "2023-04-05 08:00:00 UTC" which is why storing
its microseconds from epoch works. It also explain why converting to
LocalDateTime (Postgres specific solution) would not work.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]