SET Statement

The SET statement specifies values for query options that control the runtime behavior of other statements within the same session.

When issued in impala-shell, the SET command is interpreted as an impala-shell command that has differences from the SQL SET statement. See impala-shell Command Reference for the information about the SET command in impala-shell.

Syntax:

SET
SET ALL
SET query_option=option_value
SET query_option=""

SET and SET ALL with no arguments return a result set consisting of all the applicable query options and their current values.

The query_option and option_value are case-insensitive.

Unlike the impala-shell command version of SET, when used as a SQL statement, the string values for option_value need to be quoted, e.g. SET option="new_value".

The SET query_option = "" statement unsets the value of the query_option in the current session, reverting it to the default state. In impala-shell, use the UNSET command to set a query option to its default.

Each query option has a specific allowed notation for its arguments. See Query Options for the SET Statement for the details of each query option.

Usage notes:

In CDH 5.14 / Impala 2.11 and higher, the outputs of the SET and SET ALL statements were reorganized as below:

  • The options are divided into groups: Regular Query Options, Advanced Query Options, Development Query Options, and Deprecated Query Options.

    • The advanced options are intended for use in specific kinds of performance tuning and debugging scenarios.

    • The development options are related to internal development of Impala or features that are not yet finalized. These options might be changed or removed without notice.

    • The deprecated options are related to features that are removed or changed so that the options no longer have any purpose. These options might be removed in future versions.

  • By default, only the first two groups, regular and advanced, are displayed by the SET command. Use SET ALL to see all groups of options.

  • impala-shell options and user-specified variables are always displayed at the end of the list of query options, after all appropriate option groups.

Added in: CDH 5.2.0 / Impala 2.0.0

SET has always been available as an impala-shell command. Promoting it to a SQL statement lets you use this feature in client applications through the JDBC and ODBC APIs.

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

Cloudera Manager: You can set any of the query options globally in Cloudera Manager to affect all the queries in the cluster.

  1. Navigate to Impala cluster > Configuration > Impala Daemon Query Options Advanced Configuration Snippet (Safety Valve)
  2. In the field, type a key-value pair of a query option and the value, e.g. EXPLAIN_LEVEL=2.
  3. Click + to enter an additional option.
  4. Clive Save Changes.

Related information:

See Query Options for the SET Statement for the query options you can adjust using this statement.