aleksandar-trajkovic-db commented on code in PR #58536:
URL: https://github.com/apache/spark/pull/58536#discussion_r4105575963


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRelation.scala:
##########
@@ -216,26 +217,22 @@ private[sql] object JDBCRelation extends Logging {
   private def toBoundValueInWhereClause(
       value: Long,
       columnType: DataType,
-      timeZoneId: String): String = {
-    def dateTimeToString(): String = {
-      val dateTimeStr = columnType match {
+      timeZoneId: String,
+      dialect: JdbcDialect): String = {
+    def compileDateTimeValue(): String = {
+      val dateTimeValue = columnType match {
         case DateType =>
-          DateFormatter().format(value.toInt)
+          java.sql.Date.valueOf(DateTimeUtils.daysToLocalDate(value.toInt))

Review Comment:
   Your shouldn't use java.sql.Date/Timestamp. They use the hybrid 
Julian/Gregorian calendar. You should use 
java.time.LocalDate/LocalDateTime/Instant instead which use the proleptic 
Gregorian calendar, which is used system wide. DateFormatter and 
TimestampFormatter output proleptic Gregorian calendar date(time) values.



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

Reply via email to