Spark 2.1 - Error While instantiating HiveSessionState

后端 未结 10 1942
借酒劲吻你
借酒劲吻你 2020-12-06 06:38

With a fresh install of Spark 2.1, I am getting an error when executing the pyspark command.

Traceback (most recent call last):
File \"/usr/local/spark/pytho         


        
相关标签:
10条回答
  • 2020-12-06 07:22

    I had the same problem. Some of the answers sudo chmod -R 777 /tmp/hive/, or to downgrade spark with hadoop to 2.6 didn't work for me. I realized that what caused this problem for me is that I was doing SQL queries using the sqlContext instead of using the sparkSession.

    sparkSession =SparkSession.builder.master("local[*]").appName("appName").config("spark.sql.warehouse.dir", "./spark-warehouse").getOrCreate()
    sqlCtx.registerDataFrameAsTable(..)
    df = sparkSession.sql("SELECT ...")
    

    this perfectly works for me now.

    0 讨论(0)
  • 2020-12-06 07:22

    Spark 2.1.0 - When I run it with yarn client option - I don't see this issue, but yarn cluster mode gives "Error while instantiating 'org.apache.spark.sql.hive.HiveSessionState':".

    Still looking for answer.

    0 讨论(0)
  • 2020-12-06 07:27

    The issue for me was solved by disabling HADOOP_CONF_DIR environment variable. It was pointing to hadoop configuration directory and while starting pyspark shell, the variable caused spark to initiate hadoop cluster which wasn't initiated.

    So if you have HADOOP_CONF_DIR variable enabled, then you have to start hadoop cluster started before using spark shells

    Or you need to disable the variable.

    0 讨论(0)
  • 2020-12-06 07:29

    I too was struggling in cluster mode. Added hive-site.xml from sparkconf directory, if you have hdp cluster then it should be at /usr/hdp/current/spark2-client/conf. Its working for me.

    0 讨论(0)
提交回复
热议问题