File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
sql/core/src/main/scala/org/apache/spark/sql
execution/datasources/jdbc Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -309,8 +309,7 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
309309 val parts : Array [Partition ] = predicates.zipWithIndex.map { case (part, i) =>
310310 JDBCPartition (part, i) : Partition
311311 }
312- val schema = JDBCRelation .getSchema(sparkSession.sessionState.conf.resolver, options)
313- val relation = JDBCRelation (schema, parts, options)(sparkSession)
312+ val relation = JDBCRelation (parts, options)(sparkSession)
314313 sparkSession.baseRelationToDataFrame(relation)
315314 }
316315
Original file line number Diff line number Diff line change @@ -145,6 +145,17 @@ private[sql] object JDBCRelation extends Logging {
145145 case None => tableSchema
146146 }
147147 }
148+
149+ /**
150+ * Resolves a Catalyst schema of a JDBC table and returns [[JDBCRelation ]] with the schema.
151+ */
152+ def apply (
153+ parts : Array [Partition ],
154+ jdbcOptions : JDBCOptions )(
155+ sparkSession : SparkSession ): JDBCRelation = {
156+ val schema = JDBCRelation .getSchema(sparkSession.sessionState.conf.resolver, jdbcOptions)
157+ JDBCRelation (schema, parts, jdbcOptions)(sparkSession)
158+ }
148159}
149160
150161private [sql] case class JDBCRelation (
You can’t perform that action at this time.
0 commit comments