Apache Spark Component Guide
Also available as:
PDF
loading table of contents...

Enhancements for Connection URL Support.

The connection URL format for Hive is described in Apache Hive documentation. In user impersonation mode, the Spark Thrift server supports a default database and hivevar variables.

Specifying Default Database in the Connection URL

Specifying the connection URL as jdbc:hive2://$HOST:$PORT/my_db results in an implicit “use my_db” when a user connects.

For an example, see the preceding Beeline example where the !connect command specifies the connection URL for “foo_db”.

Support for hivevar Variables

Hive variables can be used to parameterize queries. To set a Hive variable, use the set hivevar command:

set hivevar:key=value

You can also set a Hive variable as part of the connection URL. In the following Beeline example, plan=miles is appended to the connection URL. The variable is referenced in the query as ${hivevar:plan}.