<?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: Hql to Sparksql: Hive query execution giving error in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Hql-to-Sparksql-Hive-query-execution-giving-error/m-p/242875#M204674</link>
    <description>&lt;P&gt;The above question was originally posted in the &lt;A href="https://community.hortonworks.com/spaces/101/index.html"&gt;Community Help&lt;/A&gt; track. On Tue Jul 2 18:08 UTC 2019, a member of the HCC moderation staff moved it to the &lt;A href="https://community.hortonworks.com/spaces/85/data-science.html"&gt;Data Science &amp;amp; Advanced Analytics &lt;/A&gt; track. The &lt;EM&gt;Community Help Track&lt;/EM&gt; is intended for questions about using the HCC site itself, not technical questions about The HWC Connector.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jul 2019 01:09:55 GMT</pubDate>
    <dc:creator>ask_bill_brooks</dc:creator>
    <dc:date>2019-07-03T01:09:55Z</dc:date>
    <item>
      <title>Hql to Sparksql: Hive query execution giving error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hql-to-Sparksql-Hive-query-execution-giving-error/m-p/242872#M204671</link>
      <description>&lt;P&gt;For Hadoop 3.1 i am using HWC Connector to connect to Hive and execute the queries.Below is the code snippet used for testing.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;spark-shell --jars /usr/hdp/current/hive_warehouse_connector/hive-warehouse-connector-assembly-1.0.0.3.1.0.0-78.jar

import com.hortonworks.hwc.HiveWarehouseSession
import com.hortonworks.hwc.HiveWarehouseSession._
val hive = HiveWarehouseSession.session(spark).build()
val query = sc.textFile("/user/temp/hive.hql").collect().mkString.split(";").foreach(qry =&amp;gt; hive.executeQuery(qry))
query.show()&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This is throwing error as given below.&lt;/P&gt;&lt;PRE&gt;&amp;lt;console&amp;gt;:30: error: value show is not a member of Unit&lt;/PRE&gt;&lt;P&gt;Is this not the proper way to run a hql file using Spark.&lt;/P&gt;&lt;P&gt;Please suggest.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 11:20:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hql-to-Sparksql-Hive-query-execution-giving-error/m-p/242872#M204671</guid>
      <dc:creator>Amrutha_k4</dc:creator>
      <dc:date>2019-06-20T11:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Hql to Sparksql: Hive query execution giving error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hql-to-Sparksql-Hive-query-execution-giving-error/m-p/242873#M204672</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/114814/amruthak4.html" nodeid="114814"&gt;@Amrutha K&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This is a known issue in spark reported in this Jira &lt;A rel="noopener noreferrer noopener noreferrer" href="https://issues.apache.org/jira/browse/SPARK-24260" target="_blank"&gt;SPARK-24260&lt;/A&gt; and not yet resolved.&lt;/P&gt;&lt;P&gt;One way of doing this is to execute each query at a time i.e after reading &lt;STRONG&gt;.hql &lt;/STRONG&gt;file we can access array of elemets by their indexes (0),(1)&lt;/P&gt;&lt;PRE&gt;val df1=sc.sql(sc.textFile("/user/temp/hive.hql").collect().mkString.split(";").collect()(0))&lt;/PRE&gt;&lt;PRE&gt;val df2=sc.sql(sc.textFile("/user/temp/hive.hql").collect().mkString.split(";").collect()(1))&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;(or)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If you want to just execute the queries and see the results on console then try this approach.&lt;/P&gt;&lt;PRE&gt;sc.textFile("/user/temp/hive.hql").collect().mkString.split(";").map(x =&amp;gt; sc.sql(x).show())&lt;/PRE&gt;&lt;P&gt;Now we are executing all queries in hql script and displaying results in console.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 03:37:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hql-to-Sparksql-Hive-query-execution-giving-error/m-p/242873#M204672</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-06-21T03:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Hql to Sparksql: Hive query execution giving error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hql-to-Sparksql-Hive-query-execution-giving-error/m-p/242874#M204673</link>
      <description>&lt;P&gt;Thanks Shu. The below command worked for me.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;sc.textFile("/user/temp/hive.hql").collect().mkString.split(";").map(x =&amp;gt; hive.executeQuery(x).show())&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jun 2019 11:20:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hql-to-Sparksql-Hive-query-execution-giving-error/m-p/242874#M204673</guid>
      <dc:creator>Amrutha_k4</dc:creator>
      <dc:date>2019-06-21T11:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Hql to Sparksql: Hive query execution giving error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hql-to-Sparksql-Hive-query-execution-giving-error/m-p/242875#M204674</link>
      <description>&lt;P&gt;The above question was originally posted in the &lt;A href="https://community.hortonworks.com/spaces/101/index.html"&gt;Community Help&lt;/A&gt; track. On Tue Jul 2 18:08 UTC 2019, a member of the HCC moderation staff moved it to the &lt;A href="https://community.hortonworks.com/spaces/85/data-science.html"&gt;Data Science &amp;amp; Advanced Analytics &lt;/A&gt; track. The &lt;EM&gt;Community Help Track&lt;/EM&gt; is intended for questions about using the HCC site itself, not technical questions about The HWC Connector.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 01:09:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hql-to-Sparksql-Hive-query-execution-giving-error/m-p/242875#M204674</guid>
      <dc:creator>ask_bill_brooks</dc:creator>
      <dc:date>2019-07-03T01:09:55Z</dc:date>
    </item>
  </channel>
</rss>

