rdblue commented on a change in pull request #25465: [SPARK-28747][SQL] merge 
the two data source v2 fallback configs
URL: https://github.com/apache/spark/pull/25465#discussion_r316757980
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala
 ##########
 @@ -835,14 +832,12 @@ final class DataFrameWriter[T] private[sql](ds: 
Dataset[T]) {
 
   private def modeForDSV2 = mode.getOrElse(SaveMode.Append)
 
-  private def canUseV2Source(session: SparkSession, providerClass: Class[_]): 
Boolean = {
-    val useV1Sources =
-      
session.sessionState.conf.useV1SourceWriterList.toLowerCase(Locale.ROOT).split(",")
-    val shouldUseV1Source = providerClass.newInstance() match {
-      case d: DataSourceRegister if useV1Sources.contains(d.shortName()) => 
true
-      case _ => 
useV1Sources.contains(providerClass.getCanonicalName.toLowerCase(Locale.ROOT))
+  private def lookupV2Provider() = {
+    DataSource.lookupDataSourceV2(source, df.sparkSession.sessionState.conf) 
match {
+      // File source v2 write path is currently broken.
+      case Some(_: FileDataSourceV2) => None
 
 Review comment:
   If the file sources don't support the schema from the metastore, then the 
read path should not be used. While it doesn't fail while inferring a schema, 
the source will read using the inferred schema instead of the metastore schema 
and that's a bug.
   
   For example, if I create a table with 3 columns and drop one, the data and 
the inferred schema will have the original 3 columns. But the metastore table 
will have just 2 columns. Reading with v2 would bring back a column that is 
deleted.
   
   Until the file sources are fixed, they should be disabled in all cases.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to