maropu commented on a change in pull request #28953:
URL: https://github.com/apache/spark/pull/28953#discussion_r451336630
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala
##########
@@ -46,7 +46,18 @@ class JdbcRelationProvider extends CreatableRelationProvider
val isCaseSensitive = sqlContext.conf.caseSensitiveAnalysis
val conn = JdbcUtils.createConnectionFactory(options)()
+
+ var parametersWithoutPreActions: Map[String, String] = parameters
try {
+ options.preActions match {
+ case Some(i) =>
+ runQuery(conn, i, options)
+
+ // Remove preActions to avoid duplicate execution when writing data
+ parametersWithoutPreActions =
parameters.-(JDBCOptions.JDBC_PRE_ACTIONS_STRING)
Review comment:
The code looks weird. What's the case you're worried about here?
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCOptions.scala
##########
@@ -206,6 +209,9 @@ class JDBCOptions(
}
// The principal name of user's keytab file
val principal = parameters.getOrElse(JDBC_PRINCIPAL, null)
+
+ // the query used after writing data
+ var postActions = parameters.get(JDBC_POST_ACTIONS_STRING)
Review comment:
var -> val?
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCOptions.scala
##########
@@ -116,6 +116,9 @@ class JDBCOptions(
// number of seconds. Zero means there is no limit.
val queryTimeout = parameters.getOrElse(JDBC_QUERY_TIMEOUT, "0").toInt
+ // the query used before reading/writing data
+ var preActions = parameters.get(JDBC_PRE_ACTIONS_STRING)
Review comment:
var -> val?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]