title: Avoid starting HiveThriftServer2 with created context programmatically
body: <p>We are trying to use ThriftServer to query data from spark temp tables, in spark 2.0.0.</p>
  
  <p>First, we have created sparkSession with enabled Hive Support.
  Currently, we start ThriftServer with sqlContext like this:</p>
  
  <pre><code>HiveThriftServer2.startWithContext(spark.sqlContext());
  </code></pre>
  
  <p>We have spark stream with registered temp table "spark_temp_table":</p>
  
  <pre><code>StreamingQuery streamingQuery = streamedData.writeStream()
                                               .format("memory")
                                               .queryName("spark_temp_table")
                                               .start();
  </code></pre>
  
  <p>With beeline we are able to see temp tables (running SHOW TABLES);</p>
  
  <p>When we want to run second job (with second sparkSession) with this approach we have to start second ThriftServer with different port.</p>
  
  <p>I have two questions here:</p>
  
  <ol>
  <li><p>Is there any way to have one ThriftServer on one port with access to all temp tables in a different sparkSessions?</p></li>
  <li><p><code>HiveThriftServer2.startWithContext(spark.sqlContext());</code> is annotated with <code>@DeveloperApi</code>. Is there any way to start thrift server with context not in the code programatically?<br>
  I saw there is configuration <code>--conf spark.sql.hive.thriftServer.singleSession=true</code> passed to ThriftServer on startup (sbin/start-thriftserver.sh) but I don't understand how to define this for a job. I tried to set this configuration property in sparkSession builder , but beeline didn't display temp tables.</p></li>
  </ol>