title: How to connect remote hive from spark with authentication
body: <p>I have to use my local spark to connect a remote hive with authentication.</p>
  
  <p>I am able to connect via beeline.</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>How can I convert it to using spark?
  I tried thrift and jdbc but both not working</p>
  
  <p>My trift try, don't know how to pass authentication</p>
  
  <pre><code>from pyspark.sql import SparkSession
  spark = SparkSession\
      .builder.master("yarn")\
      .appName("my app")\
      .config("hive.metastore.uris", "thrift://bigdatamr:10000")\
      .enableHiveSupport()\
      .getOrCreate()
  </code></pre>
  
  <p>My jdbc try, throw method not support</p>
  
  <pre><code>jdbcDF = spark.read \
      .format("jdbc") \
      .option("url", "jdbc:hive2://bigdatamr:10000") \
      .option("dbtable", "default.tmp") \
      .option("user", "myusername") \
      .option("password", "xxxxxxx") \
      .load()
  </code></pre>
  
  <pre><code>Py4JJavaError: An error occurred while calling o183.load.
  </code></pre>
  
  <p>: java.sql.SQLException: Method not supported</p>