yui2010 opened a new pull request #30522:
URL: https://github.com/apache/spark/pull/30522


   
   ### What changes were proposed in this pull request?
   
     1. add setSparkConf method in SparkContext
     2.set the newest sparkconf in SparkContext#getOrCreate
   
   
   ### Why are the changes needed?
   reproduce as follow code:
   
           SparkConf sparkConf = new SparkConf().setAppName("hello");
           sparkConf.set("spark.master", "local");
           JavaSparkContext jssc = new JavaSparkContext(sparkConf);
           spark = SparkSession.builder()
                   .config("spark.serializer", 
"org.apache.spark.serializer.KryoSerializer")
                   .config("hive.exec.dynamici.partition", 
true).config("hive.exec.dynamic.partition.mode", "nonstrict")
                   .config("hive.metastore.uris", "thrift://hivemetastore:9083")
                   .enableHiveSupport() 
                   .master("local")
                   .getOrCreate();
          spark.sql("select * from hudi_db.hudi_test_order").show();
   
     it will produce follow Exception     AssertionError: assertion failed: No 
plan for HiveTableRelation [`hudi_db`.`hudi_test_order` … (at current master 
branch)
    org.apache.spark.sql.AnalysisException: Table or view not found: 
`hudi_db`.`hudi_test_order`;  (at spark v2.4.4)
   
    The reason is SparkContext#getOrCreate(SparkConf) will return activeContext 
that include previous spark config if it has
    but the input SparkConf is the newest which include previous spark config 
and options.
   
    enableHiveSupport will set options (“spark.sql.catalogImplementation", 
"hive”) when spark session created it will miss this conf
    SharedState load conf from sparkContext and will miss hive catalog
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?


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



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

Reply via email to