Skip to content

Commit 2393e1d

Browse files
committed
Change function signature.
1 parent 5474a07 commit 2393e1d

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
182182
"read files of Hive data source directly.")
183183
}
184184

185-
val cls = DataSource.lookupDataSource(sparkSession.sessionState.conf, source)
185+
val cls = DataSource.lookupDataSource(source, sparkSession.sessionState.conf)
186186
if (classOf[DataSourceV2].isAssignableFrom(cls)) {
187187
val options = new DataSourceV2Options(extraOptions.asJava)
188188

sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ final class DataFrameWriter[T] private[sql](ds: Dataset[T]) {
234234

235235
assertNotBucketed("save")
236236

237-
val cls = DataSource.lookupDataSource(df.sparkSession.sessionState.conf, source)
237+
val cls = DataSource.lookupDataSource(source, df.sparkSession.sessionState.conf)
238238
if (classOf[DataSourceV2].isAssignableFrom(cls)) {
239239
cls.newInstance() match {
240240
case ds: WriteSupport =>

sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ case class AlterTableAddColumnsCommand(
231231
}
232232

233233
if (DDLUtils.isDatasourceTable(catalogTable)) {
234-
DataSource.lookupDataSource(conf, catalogTable.provider.get).newInstance() match {
234+
DataSource.lookupDataSource(catalogTable.provider.get, conf).newInstance() match {
235235
// For datasource table, this command can only support the following File format.
236236
// TextFileFormat only default to one column "value"
237237
// Hive type is already considered as hive serde table, so the logic will not

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ case class DataSource(
8888
case class SourceInfo(name: String, schema: StructType, partitionColumns: Seq[String])
8989

9090
lazy val providingClass: Class[_] =
91-
DataSource.lookupDataSource(sparkSession.sessionState.conf, className)
91+
DataSource.lookupDataSource(className, sparkSession.sessionState.conf)
9292
lazy val sourceInfo: SourceInfo = sourceSchema()
9393
private val caseInsensitiveOptions = CaseInsensitiveMap(options)
9494
private val equality = sparkSession.sessionState.conf.resolver
@@ -574,7 +574,7 @@ object DataSource extends Logging {
574574
"org.apache.spark.Logging")
575575

576576
/** Given a provider name, look up the data source class definition. */
577-
def lookupDataSource(conf: SQLConf, provider: String): Class[_] = {
577+
def lookupDataSource(provider: String, conf: SQLConf): Class[_] = {
578578
val provider1 = backwardCompatibilityMap.getOrElse(provider, provider) match {
579579
case name if name.equalsIgnoreCase("orc") && conf.getConf(SQLConf.ORC_USE_NEW_VERSION) =>
580580
classOf[OrcFileFormat].getCanonicalName

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ case class PreprocessTableCreation(sparkSession: SparkSession) extends Rule[Logi
109109

110110
// Check if the specified data source match the data source of the existing table.
111111
val conf = sparkSession.sessionState.conf
112-
val existingProvider = DataSource.lookupDataSource(conf, existingTable.provider.get)
113-
val specifiedProvider = DataSource.lookupDataSource(conf, tableDesc.provider.get)
112+
val existingProvider = DataSource.lookupDataSource(existingTable.provider.get, conf)
113+
val specifiedProvider = DataSource.lookupDataSource(tableDesc.provider.get, conf)
114114
// TODO: Check that options from the resolved relation match the relation that we are
115115
// inserting into (i.e. using the same compression).
116116
if (existingProvider != specifiedProvider) {

0 commit comments

Comments
 (0)