Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/248#discussion_r11231018
  
    --- Diff: docs/sql-programming-guide.md ---
    @@ -135,9 +285,34 @@ val hiveContext = new 
org.apache.spark.sql.hive.HiveContext(sc)
     // Importing the SQL context gives access to all the public SQL functions 
and implicit conversions.
     import hiveContext._
     
    -sql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING)")
    -sql("LOAD DATA LOCAL INPATH 'examples/src/main/resources/kv1.txt' INTO 
TABLE src")
    +hql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING)")
    +hql("LOAD DATA LOCAL INPATH 'examples/src/main/resources/kv1.txt' INTO 
TABLE src")
    +
    +// Queries are expressed in HiveQL
    +hql("FROM src SELECT key, value").collect().foreach(println)
    +{% endhighlight %}
    +
    +</div>
    +
    +<div data-lang="java"  markdown="1">
    +
    +When working with Hive one must construct a `JavaHiveContext`, which 
inherits from `JavaSQLContext`, and
    +adds support for finding tables in in the MetaStore and writing queries 
using HiveQL. In addition to
    +the `sql` method a `JavaHiveContext` also provides an `hql` methods, which 
allows queries to be
    +expressed in HiveQL.
    +
    +{% highlight java %}
    +JavaSparkContext ctx // An existing JavaSparkContext.
    +JavaHiveContext hiveCtx = new 
org.apache.spark.sql.hive.api.java.HiveContext(ctx)
    +
    +hiveCtx.hql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING)")
    +hiveCtx.hql("LOAD DATA LOCAL INPATH 'examples/src/main/resources/kv1.txt' 
INTO TABLE src")
    --- End diff --
    
    Also needs semicolons.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to