I am using spark 2.1.0 version and trying to establish a connection with Hive tables. My hive data warehouse is in /user/hive/warehouse in hdfs, by listing contents of that folder i can see all the dbname.db folders in it.
After some research i found that i need to specify the spark.sql.warehouse.dir
in spark 2.x and i set it like this
val spark = SparkSession
.builder()
.appName("Spark Hive Example")
.config("spark.sql.warehouse.dir", "/user/hive/warehouse")
.enableHiveSupport()
.getOrCreate()
and now i am trying to print the databases
spark.sql("show databases").show()
but i am only seeing default databases,
+------------+
|databaseName|
+------------+
| default|
+------------+
So i there any way i can connect the spark to the existing hive database? is there anything i am missing here?