Running HiveQL queries using Apache Spark™ SQL
Spark SQL supports queries written using HiveQL, a SQL-like language that produces queries that are converted to Spark jobs.
HiveQL is more mature and supports more complex queries than Spark SQL.
To construct a HiveQL query, first create a new HiveContext instance, and then submit the queries by calling the sql method on the HiveContext instance.
See the Hive Language Manual for the full syntax of HiveQL.
|
Creating indexes with |
Procedure
-
Start the Spark shell.
bin/dse spark -
Use the provided
HiveContextinstancesqlContextto create a new query in HiveQL by calling thesqlmethod on thesqlContextobject.scala> val results = sqlContext.sql("SELECT * FROM my_keyspace.my_table")