diff --git a/docs/topics/impala_set.xml b/docs/topics/impala_set.xml index 002018861..ddf89da42 100644 --- a/docs/topics/impala_set.xml +++ b/docs/topics/impala_set.xml @@ -21,7 +21,13 @@ under the License. SET Statement - SET + + + + SET + + + @@ -36,255 +42,130 @@ under the License.

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

-

- In and higher, SET also defines user-specified substitution variables for - the impala-shell interpreter. This feature uses the SET command - built into impala-shell instead of the SQL SET statement. - Therefore the substitution mechanism only works with queries processed by impala-shell, - not with queries submitted through JDBC or ODBC. +

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

- -

- In and higher, the output of the SET - statement changes in some important ways: -

-
    -
  • -

    - 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 the syntax 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. -

    -
  • -
  • -

    - When the SET command is run through the JDBC or ODBC interfaces, - the result set has a new third column, level, indicating which - group each option belongs to. The same distinction of SET - returning the regular and advanced options, and SET ALL - returning all option groups, applies to JDBC and ODBC also. -

    -
  • -
-
-

-SET [query_option=option_value] +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. + 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 name and any string argument values are case-insensitive. + The query_option and option_value are + case-insensitive.

- Each query option has a specific allowed notation for its arguments. Boolean options can be enabled and - disabled by assigning values of either true and false, or - 1 and 0. Some numeric options accept a final character signifying the unit, - such as 2g for 2 gigabytes or 100m for 100 megabytes. See - for the details of each query option. + 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".

- Setting query options during impala-shell invocation: -

- -

- In and higher, you can use one or more command-line options - of the form --query_option=option=value - when running the impala-shell command. The corresponding query option settings - take effect for that impala-shell session. + 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 it default.

- User-specified substitution variables: -

- -

- In and higher, you can specify your own names and string substitution values - within the impala-shell interpreter. Once a substitution variable is set up, - its value is inserted into any SQL statement in that same impala-shell session - that contains the notation ${var:varname}. - Using SET in an interactive impala-shell session overrides - any value for that same variable passed in through the --var=varname=value - command-line option. -

- -

- For example, to set up some default parameters for report queries, but then override those default - within an impala-shell session, you might issue commands and statements such as - the following: -

- - --- Initial setup for this example. -create table staging_table (s string); -insert into staging_table values ('foo'), ('bar'), ('bletch'); - -create table production_table (s string); -insert into production_table values ('North America'), ('EMEA'), ('Asia'); -quit; - --- Start impala-shell with user-specified substitution variables, --- run a query, then override the variables with SET and run the query again. -$ impala-shell --var=table_name=staging_table --var=cutoff=2 -... banner message ... -[localhost:21000] > select s from ${var:table_name} order by s limit ${var:cutoff}; -Query: select s from staging_table order by s limit 2 -+--------+ -| s | -+--------+ -| bar | -| bletch | -+--------+ -Fetched 2 row(s) in 1.06s - -[localhost:21000] > set var:table_name=production_table; -Variable TABLE_NAME set to production_table -[localhost:21000] > set var:cutoff=3; -Variable CUTOFF set to 3 - -[localhost:21000] > select s from ${var:table_name} order by s limit ${var:cutoff}; -Query: select s from production_table order by s limit 3 -+---------------+ -| s | -+---------------+ -| Asia | -| EMEA | -| North America | -+---------------+ - - -

- The following example shows how SET ALL with no parameters displays - all user-specified substitution variables, and how UNSET removes - the substitution variable entirely: -

- - -[localhost:21000] > set all; -Query options (defaults shown in []): -ABORT_ON_ERROR: [0] -COMPRESSION_CODEC: [] -DISABLE_CODEGEN: [0] -... - -Advanced Query Options: -APPX_COUNT_DISTINCT: [0] -BUFFER_POOL_LIMIT: [] -DEFAULT_JOIN_DISTRIBUTION_MODE: [0] -... - -Development Query Options: -BATCH_SIZE: [0] -DEBUG_ACTION: [] -DECIMAL_V2: [0] -... - -Deprecated Query Options: -ABORT_ON_DEFAULT_LIMIT_EXCEEDED: [0] -ALLOW_UNSUPPORTED_FORMATS: [0] -DEFAULT_ORDER_BY_LIMIT: [-1] -... - -Shell Options - LIVE_PROGRESS: False - LIVE_SUMMARY: False - -Variables: - CUTOFF: 3 - TABLE_NAME: staging_table - -[localhost:21000] > unset var:cutoff; -Unsetting variable CUTOFF -[localhost:21000] > select s from ${var:table_name} order by s limit ${var:cutoff}; -Error: Unknown variable CUTOFF - - -

- See for more examples of using the - --var, SET, and ${var:varname} - substitution technique in impala-shell. + Each query option has a specific allowed notation for its arguments. See + for the details of each query + option.

- MEM_LIMIT is probably the most commonly used query option. You can specify a high value to - allow a resource-intensive query to complete. For testing how queries would work on memory-constrained - systems, you might specify an artificially low value. + In 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 following example sets some numeric and some Boolean query options to control usage of memory, disk - space, and timeout periods, then runs a query whose success could depend on the options in effect: -

      +
    • +

      + 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. +

      +
    • +
    +
  • -set mem_limit=64g; -set DISABLE_UNSAFE_SPILLS=true; -set parquet_file_size=400m; -set RESERVATION_REQUEST_TIMEOUT=900000; -insert overwrite parquet_table select c1, c2, count(c3) from text_table group by c1, c2, c3; - +
  • +

    + 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. +

    +
  • +

- 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. + 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.

- - -

-

- See for the query options you can adjust using this - statement. + See for the query options you can + adjust using this statement.

+
+
diff --git a/docs/topics/impala_shell_commands.xml b/docs/topics/impala_shell_commands.xml index f9a48d9d1..91c6d13de 100644 --- a/docs/topics/impala_shell_commands.xml +++ b/docs/topics/impala_shell_commands.xml @@ -291,29 +291,28 @@ under the License.

- Manages query options for an impala-shell session. The available options are the - ones listed in . These options are used for - query tuning and troubleshooting. Issue SET with no arguments to see the current - query options, either based on the impalad defaults, as specified by you at - impalad startup, or based on earlier SET statements in the same - session. To modify option values, issue commands with the syntax set - option=value. To restore an option to its default, - use the unset command. Some options take Boolean values of true - and false. Others take numeric arguments, or quoted string values. + Manages query options for an impala-shell + session. The available options are the ones listed in . These options + are used for query tuning and troubleshooting. Issue + SET with no arguments to see the current + query options, either based on the impalad + defaults, as specified by you at impalad + startup, or based on earlier SET statements in + the same session. To modify option values, issue commands with + the syntax set + option=value. + To restore an option to its default, use the + unset command.

- In Impala 2.0 and later, SET is available as a SQL statement for any kind of - application, not only through impala-shell. See - for details. -

- -

- In Impala 2.5 and later, you can use SET to define your own substitution variables - within an impala-shell session. - Within a SQL statement, you substitute the value by using the notation ${var:variable_name}. + In Impala 2.0 and later, SET is + available as a SQL statement for any kind of application as well + as in impala-shell. See for details.