alekjarmov commented on code in PR #58203:
URL: https://github.com/apache/spark/pull/58203#discussion_r3852810948


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala:
##########
@@ -181,10 +182,26 @@ private case class OracleDialect() extends JdbcDialect 
with SQLConfHelper with N
       case BINARY_DOUBLE => Some(DoubleType) // Value for 
OracleTypes.BINARY_DOUBLE
       case INTERVAL_YM => Some(YearMonthIntervalType())
       case INTERVAL_DS => Some(DayTimeIntervalType())
+      case Types.TIMESTAMP if !conf.legacyOracleTimestampNTZMappingEnabled && 
typeName != null &&
+          typeName.toUpperCase(Locale.ROOT).matches("DATE|TIMESTAMP") =>
+        // Oracle DATE and TIMESTAMP are zoneless (both report typeName 
DATE/TIMESTAMP under
+        // Types.TIMESTAMP), so NTZ is faithful; WITH [LOCAL] TIME ZONE hits 
the -101/-102 case.
+        Some(TimestampNTZType)
       case _ => None
     }
   }
 
+  // Preserve the zoneless wall-clock: the driver decoded the Timestamp in the 
JVM zone, and
+  // toLocalDateTime reads those same fields back, rather than rebasing 
through UTC. Mirrors
+  // PostgresDialect.
+  override def convertJavaTimestampToTimestampNTZ(t: Timestamp): LocalDateTime 
= {

Review Comment:
   These overrides not gated by `legacyOracleTimestampNTZMappingEnabled` while  
`getCatalystType ` is gated. So flag on and `preferTimestampNTZ=true` still 
falls back to TimestampNTZType, and read hits this override (t.toLocalDateTime) 
not the 4.3 base (microsToLocalDateTime(fromJavaTimestampNoRebase(t))). Values 
differ by JVM zone offset. Oracle 01:23:45 reads 01:23:45 here but 09:23:45 in 
4.3. Flag restores type but not value while the doc claims full restore.



##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala:
##########
@@ -181,10 +182,26 @@ private case class OracleDialect() extends JdbcDialect 
with SQLConfHelper with N
       case BINARY_DOUBLE => Some(DoubleType) // Value for 
OracleTypes.BINARY_DOUBLE
       case INTERVAL_YM => Some(YearMonthIntervalType())
       case INTERVAL_DS => Some(DayTimeIntervalType())
+      case Types.TIMESTAMP if !conf.legacyOracleTimestampNTZMappingEnabled && 
typeName != null &&
+          typeName.toUpperCase(Locale.ROOT).matches("DATE|TIMESTAMP") =>
+        // Oracle DATE and TIMESTAMP are zoneless (both report typeName 
DATE/TIMESTAMP under
+        // Types.TIMESTAMP), so NTZ is faithful; WITH [LOCAL] TIME ZONE hits 
the -101/-102 case.

Review Comment:
   nit: what does -101/102 mean can this comment be clearer?



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