Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-33578

enableHiveSupport is invalid after sparkContext that without hive support created

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 3.1.0
    • 3.1.0
    • Spark Core
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            henryz steven zhang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: