File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed 
sql/core/src/test/scala/org/apache/spark/sql/sources/v2 Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -317,6 +317,21 @@ class DataSourceV2Suite extends QueryTest with SharedSQLContext {
317317    checkCanonicalizedOutput(df, 2 , 2 )
318318    checkCanonicalizedOutput(df.select(' i ), 2 , 1 )
319319  }
320+ 
321+   test(" SPARK-25425: extra options override sessions options" 
322+     val  prefix  =  " spark.datasource.test." 
323+     val  optionName  =  " optionA" 
324+     withSQLConf(prefix +  optionName ->  " true" 
325+       val  df  =  spark
326+         .read
327+         .option(optionName, false )
328+         .format(classOf [DataSourceWithSessionConfV2 ].getName).load()
329+       val  options  =  df.queryExecution.optimizedPlan.collectFirst {
330+         case  d : DataSourceV2Relation  =>  d.options
331+       }
332+       assert(options.get.get(optionName) ==  Some (" false" 
333+     }
334+   }
320335}
321336
322337
@@ -385,6 +400,9 @@ class SimpleDataSourceV2 extends DataSourceV2 with BatchReadSupportProvider {
385400  }
386401}
387402
403+ class  DataSourceWithSessionConfV2  extends  SimpleDataSourceV2  with  SessionConfigSupport  {
404+   def  keyPrefix ():  String  =  " test" 
405+ }
388406
389407class  AdvancedDataSourceV2  extends  DataSourceV2  with  BatchReadSupportProvider  {
390408
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments