Caused by: ERROR XSDB6: Another instance of Derby may have already booted the database

前端 未结 11 960
深忆病人
深忆病人 2020-12-14 17:11

I am trying to run SparkSQL :

val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)  

But the error i m getting is below:

11条回答
  •  情书的邮戳
    2020-12-14 17:40

    Another case where you can see the same error is a Spark REPL of an AWS Glue dev endpoint, when you are trying to convert a dynamic frame into a dataframe.

    There are actually several different exceptions like:

    • pyspark.sql.utils.IllegalArgumentException: u"Error while instantiating 'org.apache.spark.sql.hive.HiveSessionState':"
    • ERROR XSDB6: Another instance of Derby may have already booted the database /home/glue/metastore_db.
    • java.sql.SQLException: Failed to start database 'metastore_db' with class loader org.apache.spark.sql.hive.client.IsolatedClientLoader

    The solution is hard to find with google but eventually it is described here.

    The loaded REPL contains an instantiated SparkSession in a variable spark and you just need to stop it before creating a new SparkContext:

    >>> spark.stop()
    >>> from pyspark.context import SparkContext
    >>> from awsglue.context import GlueContext
    >>>
    >>> glue_context = GlueContext(SparkContext.getOrCreate())
    >>> glue_frame = glue_context.create_dynamic_frame.from_catalog(database=DB_NAME, table_name=T_NAME)
    >>> df = glue_frame.toDF()
    

提交回复
热议问题