Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/18411#discussion_r124318178
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala ---
@@ -68,5 +69,13 @@ private case object OracleDialect extends JdbcDialect {
case _ => None
}
+ override def beforeFetch(connection: Connection, properties: Map[String,
String]): Unit = {
+ // Set general date and timestamp format before query.
+ val stmt = connection.createStatement()
+ stmt.execute("alter session set NLS_DATE_FORMAT = 'YYYY-MM-DD'")
+ stmt.execute("alter session set NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD
HH24:MI:SS.FF'")
--- End diff --
That is my concern. We might break the existing applications. How about
making the function `compileValue` extensible to the different dialects?
```
/**
* Converts value to SQL expression.
*/
private def compileValue(value: Any): Any = value match {
case stringValue: String => s"'${escapeSql(stringValue)}'"
case timestampValue: Timestamp => "'" + timestampValue + "'"
case dateValue: Date => "'" + dateValue + "'"
case arrayValue: Array[Any] => arrayValue.map(compileValue).mkString(",
")
case _ => value
}
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]