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
See the Hive Language Manual for the full syntax of HiveQL.
Creating indexes with
Start the Spark shell.
Use the provided
sqlContextto create a new query in HiveQL by calling the
sqlmethod on the
scala> val results = sqlContext.sql("SELECT * FROM my_keyspace.my_table")