I am writing a Java Spark application that needs to connect to hive and get some basic table info and query that table for data. I am creating a spark session and getting info like below. But this uses thrift server. I want to see if I can do the same without using thrift server. Is that possible and how do I do it? I am trying to write a JDBC client that that can connect to spark via sparkSQL to access hive tables but without using thrift server. Please provide your thoughts and suggestions on how to approach this. Thank you.
SparkSession spark = SparkSession
.builder()
.appName(" Hive example")
.enableHiveSupport()
.getOrCreate();
Dataset<Row> df = spark.read()
.format("jdbc")
.option("driver", "org.apache.hive.jdbc.HiveDriver")
.option("url", " jdbc:hive2://host:port")
.option("dbtable", "mytable")
.option("fetchsize", "20")
.load();
df.show();