milastdbx commented on code in PR #59140:
URL: https://github.com/apache/spark/pull/59140#discussion_r4153683275


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala:
##########
@@ -400,10 +395,11 @@ object JdbcUtils extends Logging with SQLConfHelper {
       dialect: JdbcDialect,
       schema: StructType,
       inputMetrics: InputMetrics,
-      fetchAndTransformToInternalRowsMetric: Option[SQLMetric] = None): 
Iterator[InternalRow] = {
+      fetchAndTransformToInternalRowsMetric: Option[SQLMetric] = None,
+      options: Option[JDBCOptions] = None): Iterator[InternalRow] = {

Review Comment:
   why not required field ?



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCOptions.scala:
##########
@@ -379,4 +387,12 @@ object JDBCOptions {
   val JDBC_PREFER_TIMESTAMP_NTZ = newOption("preferTimestampNTZ")
   val JDBC_PREFER_TIMESTAMP_NANOS = newOption("preferTimestampNanos")
   val JDBC_HINT_STRING = newOption("hint")
+  // Internal: pinned by the V2 catalog via planTimeOptions. newOption keeps 
it out of the driver
+  // connection properties.
+  val JDBC_LEGACY_ORACLE_TIMESTAMP_NTZ_MAPPING = 
newOption("__legacyOracleTimestampNTZMapping")

Review Comment:
   these seem generic, hence i dont think we should call this option "oracle"



##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -217,6 +217,13 @@ abstract class JdbcDialect extends Serializable with 
Logging {
     toJavaTimestampNoRebase(micros)
   }
 
+  /**
+   * Whether TimestampNTZType values are read and written as zoneless 
`LocalDateTime` rather than
+   * through `java.sql.Timestamp`. Dialects decide from the `JDBCOptions` of 
the read or write.
+   */
+  @Since("4.4.0")
+  def timestampNTZAsWallClock(options: JDBCOptions): Boolean = false

Review Comment:
   why do we need this method ? 
   cant we always just target single options and each dialect decides to set it 
or no based on their config?



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -153,8 +153,8 @@ class JDBCTableCatalog extends TableCatalog
 
   override def loadTable(ident: Identifier): Table = {
     JdbcUtils.withConnection(options) { conn =>
-      val optionsWithTableName = new JDBCOptions(
-        options.parameters + (JDBCOptions.JDBC_TABLE_NAME -> 
getTableName(ident)))
+      val tableOptions = new JDBCOptions(options.parameters +
+        (JDBCOptions.JDBC_TABLE_NAME -> getTableName(ident)) ++ 
JDBCOptions.planTimeOptions)

Review Comment:
   this looks like an overkill.
   
   cant we use OptionsTranslator for this ?



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