<?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 connect and run Hive query from Apache Spark in JAVA in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-and-run-Hive-query-from-Apache-Spark-in-JAVA/m-p/190447#M59061</link>
    <description>&lt;P&gt;A simple Spark1 Java application to show a list of tables in Hive Metastore is as follows:&lt;/P&gt;&lt;PRE&gt;import org.apache.spark.SparkContext;
import org.apache.spark.SparkConf;
import org.apache.spark.sql.hive.HiveContext;
import org.apache.spark.sql.DataFrame;

public class SparkHiveExample {
  public static void main(String[] args) {
    SparkConf conf = new SparkConf().setAppName("SparkHive Example");
    SparkContext sc = new SparkContext(conf);
    HiveContext hiveContext = new org.apache.spark.sql.hive.HiveContext(sc);
    DataFrame df = hiveContext.sql("show tables");
    df.show();
  }
}&lt;/PRE&gt;&lt;P&gt;Note that Spark pulls metadata from Hive metastore and also uses hiveql for parsing queries but the execution of queries as such happens in the Spark execution engine.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Apr 2017 06:52:06 GMT</pubDate>
    <dc:creator>deepesh1</dc:creator>
    <dc:date>2017-04-07T06:52:06Z</dc:date>
    <item>
      <title>How to connect and run Hive query from Apache Spark in JAVA</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-and-run-Hive-query-from-Apache-Spark-in-JAVA/m-p/190446#M59060</link>
      <description>&lt;P&gt;In Sprig I am running Spark Application. Now I want to connect to HIVE to run HIVE query in Spring Suite itself.&lt;/P&gt;&lt;P&gt;How to do this?&lt;/P&gt;&lt;P&gt;I learned that HiveContext could be used but am clueless how to use this?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2017 19:06:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-and-run-Hive-query-from-Apache-Spark-in-JAVA/m-p/190446#M59060</guid>
      <dc:creator>pradhumankumar_</dc:creator>
      <dc:date>2017-04-06T19:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to connect and run Hive query from Apache Spark in JAVA</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-and-run-Hive-query-from-Apache-Spark-in-JAVA/m-p/190447#M59061</link>
      <description>&lt;P&gt;A simple Spark1 Java application to show a list of tables in Hive Metastore is as follows:&lt;/P&gt;&lt;PRE&gt;import org.apache.spark.SparkContext;
import org.apache.spark.SparkConf;
import org.apache.spark.sql.hive.HiveContext;
import org.apache.spark.sql.DataFrame;

public class SparkHiveExample {
  public static void main(String[] args) {
    SparkConf conf = new SparkConf().setAppName("SparkHive Example");
    SparkContext sc = new SparkContext(conf);
    HiveContext hiveContext = new org.apache.spark.sql.hive.HiveContext(sc);
    DataFrame df = hiveContext.sql("show tables");
    df.show();
  }
}&lt;/PRE&gt;&lt;P&gt;Note that Spark pulls metadata from Hive metastore and also uses hiveql for parsing queries but the execution of queries as such happens in the Spark execution engine.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 06:52:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-connect-and-run-Hive-query-from-Apache-Spark-in-JAVA/m-p/190447#M59061</guid>
      <dc:creator>deepesh1</dc:creator>
      <dc:date>2017-04-07T06:52:06Z</dc:date>
    </item>
  </channel>
</rss>

