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

spark 2.0.1 enable hive throw AlreadyExistsException(message:Database default already exists)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.1.0
    • SQL
    • None
    • jdk1.8, macOs,spark 2.0.1

    Description

      in spark 2.0.1 ,I enable hive support and when init the sqlContext ,throw a AlreadyExistsException(message:Database default already exists),same as
      https://www.mail-archive.com/dev@spark.apache.org/msg15306.html ,my code is

        private val master = "local[*]"
        private val appName = "xqlServerSpark"
        val fileSystem = FileSystem.get()
        val sparkConf = new SparkConf().setMaster(master).
          setAppName(appName).set("spark.sql.warehouse.dir", s"${fileSystem.getUri.toASCIIString}/user/hive/warehouse")
        val   hiveContext = SparkSession.builder().config(sparkConf).enableHiveSupport().getOrCreate().sqlContext
          print(sparkConf.get("spark.sql.warehouse.dir"))
          hiveContext.sql("show tables").show()
      

      the result is correct,but a exception also throwBy the code

      Attachments

        Activity

          People

            cloud_fan Wenchen Fan
            cjuexuan todd.chen
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: