File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
sql/core/src/main/scala/org/apache/spark/sql
execution/datasources/jdbc Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ import org.apache.spark.internal.Logging
2727import org .apache .spark .internal .LogKeys .SQL_TEXT
2828import org .apache .spark .rdd .RDD
2929import org .apache .spark .sql .catalyst .InternalRow
30- import org .apache .spark .sql .catalyst .util .CaseInsensitiveMap
3130import org .apache .spark .sql .connector .expressions .filter .Predicate
3231import org .apache .spark .sql .execution .datasources .{DataSourceMetricsMixin , ExternalEngineDatasourceRDD }
3332import org .apache .spark .sql .execution .datasources .v2 .TableSampleInfo
@@ -306,8 +305,7 @@ class JDBCRDD(
306305 val inputMetrics = context.taskMetrics().inputMetrics
307306 val part = thePart.asInstanceOf [JDBCPartition ]
308307 conn = getConnection(part.idx)
309- import scala .jdk .CollectionConverters ._
310- dialect.beforeFetch(conn, CaseInsensitiveMap (options.asProperties.asScala.toMap))
308+ dialect.beforeFetch(conn, options)
311309
312310 // This executes a generic SQL statement (or PL/SQL block) before reading
313311 // the table/query via JDBC. Use this feature to initialize the database
Original file line number Diff line number Diff line change @@ -342,9 +342,20 @@ abstract class JdbcDialect extends Serializable with Logging {
342342 * @param connection The connection object
343343 * @param properties The connection properties. This is passed through from the relation.
344344 */
345+ @ deprecated(" Use beforeFetch(Connection, JDBCOptions) instead" , " 4.0.0" )
345346 def beforeFetch (connection : Connection , properties : Map [String , String ]): Unit = {
346347 }
347348
349+ /**
350+ * Override connection specific properties to run before a select is made. This is in place to
351+ * allow dialects that need special treatment to optimize behavior.
352+ * @param connection The connection object
353+ * @param options The JDBC options for the connection.
354+ */
355+ def beforeFetch (connection : Connection , options : JDBCOptions ): Unit = {
356+ beforeFetch(connection, options.parameters)
357+ }
358+
348359 /**
349360 * Escape special characters in SQL string literals.
350361 * @param value The string to be escaped.
You can’t perform that action at this time.
0 commit comments