<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Spark2 shell is not displaying all Hive databases. only listing default database in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193781#M155841</link>
    <description>&lt;P&gt;Hi Vinay,&lt;/P&gt;&lt;P&gt;use the below code to connect hive and list the databases :&lt;/P&gt;&lt;P&gt;spark-shell --conf spark.sql.hive.hiveserver2.jdbc.url="jdbc:hive2://hiveserverip:10000/" spark.datasource.hive.warehouse.load.staging.dir="/tmp" spark.hadoop.hive.zookeeper.quorum="zookeeperquoremip:2181" --jars /usr/hdp/current/hive_warehouse_connector/hive-warehouse-connector-assembly-1.0.0.3.0.0.0-1634.jar&lt;/P&gt;&lt;P&gt;val hive = com.hortonworks.spark.sql.hive.llap.HiveWarehouseBuilder.session(spark).build()&lt;/P&gt;&lt;P&gt;hive.showDatabases().show(100, false)&lt;/P&gt;&lt;P&gt;Reference article &lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/hortonworks-spark/spark-llap/tree/master" target="_blank"&gt;https://github.com/hortonworks-spark/spark-llap/tree/master&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jan 2019 14:16:32 GMT</pubDate>
    <dc:creator>subhash_parise3</dc:creator>
    <dc:date>2019-01-07T14:16:32Z</dc:date>
    <item>
      <title>Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193774#M155834</link>
      <description>&lt;P&gt;I am using HDP 3.0 with Hive LLAP.&lt;/P&gt;&lt;P&gt;I have pasted the code and output below:&lt;/P&gt;&lt;P&gt;scala&amp;gt; import org.apache.spark.sql.hive.HiveContext &lt;/P&gt;&lt;P&gt;import org.apache.spark.sql.hive.HiveContext &lt;/P&gt;&lt;P&gt;scala&amp;gt; val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)&lt;/P&gt;&lt;P&gt;
warning: there was one deprecation warning; re-run with -deprecation for details
sqlContext: org.apache.spark.sql.hive.HiveContext = org.apache.spark.sql.hive.HiveContext@19e03398&lt;/P&gt;&lt;P&gt;
scala&amp;gt; sqlContext.sql("show databases").show() &lt;/P&gt;&lt;P&gt;+------------+&lt;/P&gt;&lt;P&gt;
|databaseName|&lt;/P&gt;&lt;P&gt;+------------+ &lt;/P&gt;&lt;P&gt;|     default|
+&lt;/P&gt;&lt;P&gt;------------+&lt;/P&gt;&lt;P&gt;In Hive shell i am able to see all the databases:&lt;/P&gt;&lt;P&gt;0: jdbc:hive2://ip-10-0-10-76.amer.o9solution&amp;gt; show databases;
INFO  : Compiling command(queryId=hive_20180924093400_b66c3d0c-8e76-4a16-aed7-771fcae43225): show databases
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=hive_20180924093400_b66c3d0c-8e76-4a16-aed7-771fcae43225); Time taken: 0.003 seconds
INFO  : Executing command(queryId=hive_20180924093400_b66c3d0c-8e76-4a16-aed7-771fcae43225): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=hive_20180924093400_b66c3d0c-8e76-4a16-aed7-771fcae43225); Time taken: 0.005 seconds
INFO  : OK &lt;/P&gt;&lt;P&gt;+---------------------+&lt;/P&gt;&lt;P&gt;
|    database_name    | &lt;/P&gt;&lt;P&gt;+---------------------+&lt;/P&gt;&lt;P&gt;
| default             |&lt;/P&gt;&lt;P&gt;
| information_schema  |&lt;/P&gt;&lt;P&gt;
| rh_ml               |&lt;/P&gt;&lt;P&gt;
| schema_7539         |&lt;/P&gt;&lt;P&gt;
| sys                 | &lt;/P&gt;&lt;P&gt;+---------------------+&lt;/P&gt;&lt;P&gt;Any help to resolve this issue? Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 16:37:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193774#M155834</guid>
      <dc:creator>subhash_parise3</dc:creator>
      <dc:date>2018-09-24T16:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193775#M155835</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1852/subhashparise36.html" nodeid="1852"&gt;@subhash parise&lt;/A&gt; &lt;/P&gt;&lt;P&gt;From HDP 3.0 onwards spark has its own separate catalog. This is reason why you don't see any hive databases. To work with hive databases you should use the &lt;B&gt;HiveWarehouseConnector&lt;/B&gt;. Link to documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.hortonworks.com/HDPDocuments/HDP3/HDP-3.0.0/integrating-hive/content/hive_configure_a_spark_hive_connection.html" target="_blank"&gt;https://docs.hortonworks.com/HDPDocuments/HDP3/HDP-3.0.0/integrating-hive/content/hive_configure_a_spark_hive_connection.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 19:25:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193775#M155835</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-09-24T19:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193776#M155836</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm facing same issue. I have also added following properties in spark configuration. But still it's not working.&lt;/P&gt;&lt;P&gt;spark.sql.hive.hiveserver2.jdbc.url:jdbc:hive2://hive_server_FQDN:10000/&lt;/P&gt;&lt;P&gt;spark.datasource.hive.warehouse.metastoreUri: thrift://hive_server_FQDN:9083&lt;/P&gt;&lt;P&gt;spark.datasource.hive.warehouse.load.staging.dir: /tmp&lt;/P&gt;&lt;P&gt;spark.hadoop.hive.llap.daemon.service.hosts: @llap0&lt;/P&gt;&lt;P&gt;spark.hadoop.hive.zookeeper.quorum: hadoop3.test.com:2181&lt;/P&gt;&lt;P&gt;spark.sql.hive.hiveserver2.jdbc.url.principal: hive/_HOST@TEST.COM&lt;/P&gt;</description>
      <pubDate>Mon, 31 Dec 2018 17:13:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193776#M155836</guid>
      <dc:creator>vinayk</dc:creator>
      <dc:date>2018-12-31T17:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193777#M155837</link>
      <description>&lt;P&gt;Hi Vinay,&lt;/P&gt;&lt;P&gt;does the spark user is having sufficient privileges to access hive db and table?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Dec 2018 17:16:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193777#M155837</guid>
      <dc:creator>subhash_parise3</dc:creator>
      <dc:date>2018-12-31T17:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193778#M155838</link>
      <description>&lt;P&gt;Hi Subhash&lt;/P&gt;&lt;P&gt;I have already added spark user for access the all database by ranger and all HDFS storage path.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 20:09:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193778#M155838</guid>
      <dc:creator>vinayk</dc:creator>
      <dc:date>2019-01-02T20:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193779#M155839</link>
      <description>&lt;P&gt;Hi VInay,&lt;/P&gt;&lt;P&gt;can you post spark code which is using to display the databases ?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 20:21:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193779#M155839</guid>
      <dc:creator>subhash_parise3</dc:creator>
      <dc:date>2019-01-02T20:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193780#M155840</link>
      <description>&lt;P&gt;
	Hi Subhash&lt;/P&gt;&lt;P&gt;
	below is code&lt;/P&gt;&lt;PRE&gt;from pyspark import SparkConf
from pyspark.sql import SparkSession, HiveContext
from pyspark.sql import functions as fn
from pyspark.sql.functions import rank,sum,col
from pyspark.sql import Window
sparkSession = (SparkSession
                .builder
                .master("local")
                .appName('sprk-job')
                .enableHiveSupport()
                .getOrCreate())
sparkSession.sql("show databases").show()
sparkSession.stop()
&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;Even i'm also trying from spark-shell.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 20:54:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193780#M155840</guid>
      <dc:creator>vinayk</dc:creator>
      <dc:date>2019-01-02T20:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193781#M155841</link>
      <description>&lt;P&gt;Hi Vinay,&lt;/P&gt;&lt;P&gt;use the below code to connect hive and list the databases :&lt;/P&gt;&lt;P&gt;spark-shell --conf spark.sql.hive.hiveserver2.jdbc.url="jdbc:hive2://hiveserverip:10000/" spark.datasource.hive.warehouse.load.staging.dir="/tmp" spark.hadoop.hive.zookeeper.quorum="zookeeperquoremip:2181" --jars /usr/hdp/current/hive_warehouse_connector/hive-warehouse-connector-assembly-1.0.0.3.0.0.0-1634.jar&lt;/P&gt;&lt;P&gt;val hive = com.hortonworks.spark.sql.hive.llap.HiveWarehouseBuilder.session(spark).build()&lt;/P&gt;&lt;P&gt;hive.showDatabases().show(100, false)&lt;/P&gt;&lt;P&gt;Reference article &lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/hortonworks-spark/spark-llap/tree/master" target="_blank"&gt;https://github.com/hortonworks-spark/spark-llap/tree/master&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 14:16:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193781#M155841</guid>
      <dc:creator>subhash_parise3</dc:creator>
      <dc:date>2019-01-07T14:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193782#M155842</link>
      <description>&lt;P&gt;Thanks for posting this answer, Subhash.&lt;/P&gt;&lt;P&gt;I thought I was going crazy, because I was using HDP 2.X sandbox before and that's all what one had to do to query HIVE-created tables from Spark:&lt;/P&gt;&lt;PRE&gt;%pyspark
from pyspark.sql import HiveContext
hive_context = HiveContext(sc)
hive_context.sql('show tables').show()&lt;/PRE&gt;&lt;P&gt;Many posts out there say that not having ./conf/hive-site.xml may be the problem, but it DOES exist on the HDP 3.0.1 sandbox, while HiveContext still shows only Spark-created tables (both permanent and temporary).&lt;/P&gt;&lt;P&gt;So I have a follow-up question:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is the value "thrift://sandbox-hdp.hortonworks.com:9083" correct for the property "hive.metastore.uris" in ./conf/hive-site.xml?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here's the entry for this host from /etc/hosts:&lt;/P&gt;&lt;PRE&gt;172.18.0.2 &amp;nbsp; &amp;nbsp; &amp;nbsp;sandbox-hdp.hortonworks.com sandbox-hdp&lt;/PRE&gt;&lt;P&gt;Is this the IP address of one of the hosts in the virtual cluster? (I am using HDP Sandbox 3.0.1)&lt;/P&gt;&lt;P&gt;Changing the host IP address to 172.0.0.1 (same as localhost) results in an error while trying to create and use HiveContext - connection refused, probably meaning that the Thrift server is NOT running on port number 9083 of the sandbox VM ???&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 04:27:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/193782#M155842</guid>
      <dc:creator>gene_mishchenko</dc:creator>
      <dc:date>2019-05-07T04:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/279968#M208577</link>
      <description>&lt;P&gt;On Spark 2 and HDP 3.x . Edit file "/usr/hdp/3.1.4.0-315/spark2/conf/hive-site.xml"&lt;/P&gt;&lt;P&gt;. Remove property below:&lt;/P&gt;&lt;P&gt;"&amp;lt;property&amp;gt;&lt;BR /&gt;&amp;lt;name&amp;gt;metastore.catalog.default&amp;lt;/name&amp;gt;&lt;BR /&gt;&amp;lt;value&amp;gt;spark&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;lt;/property&amp;gt;"&lt;/P&gt;&lt;P&gt;After i show all databases:&lt;/P&gt;&lt;P&gt;scala&amp;gt; val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc);&lt;BR /&gt;warning: there was one deprecation warning; re-run with -deprecation for details&lt;BR /&gt;sqlContext: org.apache.spark.sql.hive.HiveContext = org.apache.spark.sql.hive.HiveContext@4e6881e&lt;/P&gt;&lt;P&gt;scala&amp;gt; sqlContext.sql("show databases").show();&lt;BR /&gt;Hive Session ID = edac02b0-c2f7-4cd9-919d-97bff977be3b&lt;BR /&gt;+------------------+&lt;BR /&gt;| databaseName|&lt;BR /&gt;+------------------+&lt;BR /&gt;| default|&lt;BR /&gt;|information_schema|&lt;BR /&gt;| sys|&lt;BR /&gt;| toy_store|&lt;BR /&gt;| website|&lt;BR /&gt;+------------------+&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="gtx-trans-icon"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 Oct 2019 10:06:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/279968#M208577</guid>
      <dc:creator>PhuNHB</dc:creator>
      <dc:date>2019-10-11T10:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 shell is not displaying all Hive databases. only listing default database</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/335515#M231963</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;Spark and Hive use separate catalogs to access SparkSQL or Hive tables in HDP 3.0 and later. The Spark catalog contains a table created by Spark. The Hive catalog contains a table created by Hive. By default,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;standard Spark APIs access tables in the Spark catalog. To access tables in the hive catalog, we have to edit the&amp;nbsp;&lt;STRONG&gt;metastore.catalog.default&lt;/STRONG&gt;&amp;nbsp;property in hive-site.xml (Set that property value to 'hive' instead of 'spark').&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Config File Path:  $SPARK_HOME/conf/hive-site.xml&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;EM&gt;Before change the config&lt;/EM&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;property&amp;gt;
    &amp;lt;name&amp;gt;metastore.catalog.default&amp;lt;/name&amp;gt;
    &amp;lt;value&amp;gt;spark&amp;lt;/value&amp;gt;
&amp;lt;/property&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="before_change_conf.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/33476iB970CDBA799D05CD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="before_change_conf.png" alt="before_change_conf.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;After change the config&lt;/STRONG&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;property&amp;gt;
    &amp;lt;name&amp;gt;metastore.catalog.default&amp;lt;/name&amp;gt;
    &amp;lt;value&amp;gt;hive&amp;lt;/value&amp;gt;
&amp;lt;/property&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="after_change_conf.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/33475iA157196305C7647A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="after_change_conf.png" alt="after_change_conf.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 02 Feb 2022 16:15:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Spark2-shell-is-not-displaying-all-Hive-databases-only/m-p/335515#M231963</guid>
      <dc:creator>egdsandaru</dc:creator>
      <dc:date>2022-02-02T16:15:37Z</dc:date>
    </item>
  </channel>
</rss>

