I have to use my local spark to connect a remote hive with authentication.
I am able to connect via beeline.
beeline> !connect jdbc:hive2://bigdatamr:10000/default Connecting to jdbc:hive2://bigdatamr:10000/default Enter username for jdbc:hive2://bigdatamr:10000/default: myusername Enter password for jdbc:hive2://bigdatamr:10000/default: ******** Connected to: Apache Hive (version 1.2.0-mapr-1703) Driver: Hive JDBC (version 1.2.0-mapr-1703) Transaction isolation: TRANSACTION_REPEATABLE_READ
How can I convert it to using spark? I tried thrift and jdbc but both not working
My trift try, don't know how to pass authentication
from pyspark.sql import SparkSession
spark = SparkSession\
.builder.master("yarn")\
.appName("my app")\
.config("hive.metastore.uris", "thrift://bigdatamr:10000")\
.enableHiveSupport()\
.getOrCreate()
My jdbc try, throw method not support
jdbcDF = spark.read \
.format("jdbc") \
.option("url", "jdbc:hive2://bigdatamr:10000") \
.option("dbtable", "default.tmp") \
.option("user", "myusername") \
.option("password", "xxxxxxx") \
.load()
Py4JJavaError: An error occurred while calling o183.load.
: java.sql.SQLException: Method not supported