<?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: how to access the hive tables from spark-shell in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61172#M21469</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the last week i have resolved the same problem for Spark 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this I've select the Hive Service dependance on the Spark 2 service Configuration page (Service-Wide Category):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Spark2.png" style="width: 600px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/3513i9E33784A8CDBDDFD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Spark2.png" alt="Spark2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After stale services was restarted Spark 2&amp;nbsp;started to works correctly.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Oct 2017 11:23:08 GMT</pubDate>
    <dc:creator>Jeno</dc:creator>
    <dc:date>2017-10-23T11:23:08Z</dc:date>
    <item>
      <title>how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/36609#M21461</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am trying to access the already existing table in hive by using spark shell&lt;BR /&gt;&lt;BR /&gt;But when I run the instructions, error comes "table not found".&lt;BR /&gt;&lt;BR /&gt;e.g. in hive table is existing name as "department" in default database.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i start the spark-shell and execute the following set of instructions.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;import org.apache.spark.sql.hive.HiveContext&lt;BR /&gt;val sqlContext = new HiveContext(sc)&lt;BR /&gt;val depts = sqlContext.sql("select * from departments")&lt;BR /&gt;depts.collecat().foreach(println)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;but it coudn't find the table.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now My questions are:&lt;BR /&gt;&lt;BR /&gt;1. As I know ny using HiveContext spark can access the hive metastore. But it is not doing here, so is there any configuration setup required?&amp;nbsp; I am using Cloudera quickstart VM 5..5&lt;BR /&gt;&lt;BR /&gt;2. As an alternative I created the table on spark-shell , load a data file and then performed some queries and then exit the spark shell.&lt;BR /&gt;&lt;BR /&gt;3. even if I create the table using spark-shell, it is not anywhere existing when I am trying to access it using hive editor.&lt;BR /&gt;&lt;BR /&gt;4. when i again start the spark-shell , then earlier table i created, was no longer existing, so exactly where this table and metadata is stored and all....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am very much confused, because accroding to theortical concepts, it should go under the hive metastore.&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 09:59:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/36609#M21461</guid>
      <dc:creator>fnushelly</dc:creator>
      <dc:date>2022-09-16T09:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/36653#M21462</link>
      <description>&lt;P&gt;to connect to hive metastore you need to copy the hive-site.xml file into spark/conf directory. After that spark will be able to connect to hive metastore.&lt;BR /&gt;so run the&amp;nbsp; following ommand after log in as root user&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cp&amp;nbsp; /usr/lib/hive/conf/hive-site.xml &amp;nbsp;&amp;nbsp; /usr/lib/spark/conf/&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2016 21:03:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/36653#M21462</guid>
      <dc:creator>fnushelly</dc:creator>
      <dc:date>2016-01-26T21:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/44643#M21463</link>
      <description>&lt;P&gt;Or you create a symbolic link to avoid file version syncing issues:&lt;/P&gt;&lt;PRE&gt;ln -s /usr/lib/hive/conf/hive-site.xml &amp;nbsp;&amp;nbsp; /usr/lib/spark/conf/hive-site.xml&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Sep 2016 21:00:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/44643#M21463</guid>
      <dc:creator>sofiane</dc:creator>
      <dc:date>2016-09-01T21:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/49050#M21464</link>
      <description>&lt;P&gt;Still the issue is persisting,&lt;/P&gt;&lt;P&gt;What else can we do to make it work other than hive-site.xml&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 07:47:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/49050#M21464</guid>
      <dc:creator>jack0188</dc:creator>
      <dc:date>2017-01-04T07:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/49443#M21465</link>
      <description>&lt;P&gt;which version spark are you using?&lt;/P&gt;&lt;P&gt;assuming you are using 1.4v or higher.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import org.apache.spark.sql.hive.HiveContext&lt;BR /&gt;import sqlContext.implicits._&lt;BR /&gt;val hiveObj = new HiveContext(sc)&lt;/P&gt;&lt;P&gt;hiveObj.refreshTable("db.table") // if you have uograded your hive do this, to refresh the tables.&lt;BR /&gt;&lt;BR /&gt;val sample = sqlContext.sql("select * from table").collect()&lt;BR /&gt;sample.foreach(println)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This has worked for me&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jan 2017 05:41:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/49443#M21465</guid>
      <dc:creator>jack0188</dc:creator>
      <dc:date>2017-01-15T05:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/55001#M21466</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did u fix this issue?&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 12:17:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/55001#M21466</guid>
      <dc:creator>RajeshMohapatra</dc:creator>
      <dc:date>2017-05-24T12:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/56708#M21467</link>
      <description>&lt;P&gt;I have downloaded Cloudera quickstart 5.10 for VirtualBox.&lt;/P&gt;&lt;P&gt;But it's not loading hive data into spark&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import org.apache.spark.sql.hive.HiveContext&lt;BR /&gt;import sqlContext.implicits._&lt;BR /&gt;val hiveObj = new HiveContext(sc)&lt;/P&gt;&lt;P&gt;hiveObj.refreshTable("db.table") // if you have uograded your hive do this, to refresh the tables.&lt;BR /&gt;&lt;BR /&gt;val sample = sqlContext.sql("select * from table").collect()&lt;BR /&gt;sample.foreach(println)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still i'm getting the error as table not found(It's not accessing metadata)&lt;/P&gt;&lt;P&gt;What should i do, Any one pls help me&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 11:39:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/56708#M21467</guid>
      <dc:creator>hadoopSparkZen</dc:creator>
      <dc:date>2017-06-29T11:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/57971#M21468</link>
      <description>&lt;P&gt;I'm having the same issue. I'm using CDH 5.10 with Spark on Yarn&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, is there a way to incllude hive-site.xml through Cloudera Manager? At the moment I have a script to make sure that the symlink is there (and links to the correct hive-site.xml) in the whole cluster, but getting Cloudera Manager to do it for me would be easier, faster and less error prone.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 10:27:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/57971#M21468</guid>
      <dc:creator>miguelalonso</dc:creator>
      <dc:date>2017-07-25T10:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61172#M21469</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the last week i have resolved the same problem for Spark 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this I've select the Hive Service dependance on the Spark 2 service Configuration page (Service-Wide Category):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Spark2.png" style="width: 600px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/3513i9E33784A8CDBDDFD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Spark2.png" alt="Spark2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After stale services was restarted Spark 2&amp;nbsp;started to works correctly.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 11:23:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61172#M21469</guid>
      <dc:creator>Jeno</dc:creator>
      <dc:date>2017-10-23T11:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61642#M21470</link>
      <description>&lt;P&gt;I am having the same issue and copying the hive-site.xml did not resolve the issue for me.&amp;nbsp; I am not using spark2, but the v1.6 that comes with Cloudera 5.13 - and there is no spark/hive configuration setting.&amp;nbsp; Was anyone else able to figure out how to fix this?&amp;nbsp; Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 17:19:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61642#M21470</guid>
      <dc:creator>Sentara</dc:creator>
      <dc:date>2017-11-08T17:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61655#M21471</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you installed the appropriate&amp;nbsp;Gateways&amp;nbsp;on the server where these configuration settings are required?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 07:19:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61655#M21471</guid>
      <dc:creator>Jeno</dc:creator>
      <dc:date>2017-11-09T07:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61663#M21472</link>
      <description>Yes, I have a spark gateway on the host and I copied hive-site.xml into /etc/spark/conf.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Nov 2017 10:42:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61663#M21472</guid>
      <dc:creator>Sentara</dc:creator>
      <dc:date>2017-11-09T10:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61664#M21473</link>
      <description>&lt;P&gt;On the Spark configuration page i dont have Hive checkbox too.&lt;/P&gt;&lt;P&gt;Try to install another version of Spark.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 11:29:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/61664#M21473</guid>
      <dc:creator>Jeno</dc:creator>
      <dc:date>2017-11-09T11:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/67465#M21474</link>
      <description>&lt;P&gt;Try "select * from db.table" in line 3&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 06:49:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/67465#M21474</guid>
      <dc:creator>NehaTaishy</dc:creator>
      <dc:date>2018-05-21T06:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/81128#M21475</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to access the already existing table in hive by using pyspark&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;e.g. in hive table is existing name as "department" in default database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;err msg :-&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;18/10/15 22:01:23 WARN shortcircuit.DomainSocketFactory: The short-circuit local reads feature cannot be used because libhadoop cannot be loaded.&lt;BR /&gt;18/10/15 22:02:35 WARN metastore.ObjectStore: Version information not found in metastore. hive.metastore.schema.verification is not enabled so recording the schema version 1.1.0-cdh5.13.0&lt;BR /&gt;18/10/15 22:02:38 WARN metastore.ObjectStore: Failed to get database default, returning NoSuchObjectException&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I checked the below files, they are same.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;/usr/lib/hive/conf/hive-site.xml &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;/usr/lib/spark/conf/hive-site.xml&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help on how to set up the HiveContext from pyspark is highly appreciated.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 06:45:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/81128#M21475</guid>
      <dc:creator>Deepanjan</dc:creator>
      <dc:date>2018-10-16T06:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/86652#M21477</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just in case someone still needs the solution, here is what i tried and it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;spark-shell --driver-java-options "-Dhive.metastore.uris=thrift://quickstart:9083"&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;I am using spark 1.6 with cloudera vm.&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;val df=sqlContext.sql("show databases")&lt;/P&gt;&lt;P class="p1"&gt;df.show&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;You should be able to see all the databases in hive. I hope it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 21:34:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/86652#M21477</guid>
      <dc:creator>MichelleY</dc:creator>
      <dc:date>2019-02-18T21:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/86841#M21478</link>
      <description>I tried this. but its permission denied.&lt;BR /&gt;Can you please help</description>
      <pubDate>Sat, 23 Feb 2019 10:41:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/86841#M21478</guid>
      <dc:creator>patwa95</dc:creator>
      <dc:date>2019-02-23T10:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to access the hive tables from spark-shell</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/366015#M239468</link>
      <description>&lt;P&gt;You are life saver, I have been struggling with this for 7-8 hours and my deadline to submit a case study was close. Thanks alot!!!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 20:11:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-access-the-hive-tables-from-spark-shell/m-p/366015#M239468</guid>
      <dc:creator>Vipuly2j</dc:creator>
      <dc:date>2023-03-13T20:11:50Z</dc:date>
    </item>
  </channel>
</rss>

