Impala Shell Configuration Options

You can specify the following options when starting impala-shell to control how shell commands are executed. You can specify options on the command line or in the impala-shell configuration file.

Command-Line Option Configuration File Setting Explanation

-B or

--delimited

write_delimited=true

Causes all query results to be printed in plain format as a delimited text file. Useful for producing data files to be used with other Hadoop components. Also useful for avoiding the performance overhead of pretty-printing all output, especially when running benchmark tests using queries returning large result sets. Specify the delimiter character with the --output_delimiter option. Store all query results in a file rather than printing to the screen with the -B option.

-E or

--vertical

vertical=true

Causes all query results to print in vertical format. In this mode, impala-shell will print each row in the following style.

  • The first line will contain the line number followed by the row's columns in separate lines. Each column line will have a prefix with its name and a colon.

To enable this mode, use the shell option '-E' or '--vertical', or 'set VERTICAL= true' in the interactive mode. To disable it in interactive mode, 'set VERTICAL=false'. NOTE: This vertical option will be disabled if the '-B' option or 'set WRITE_DELIMITED=true' is specified.

--connect_max_tries --connect_max_tries=4 Sets the maximum number of attempts to connect to a coordinator. Currently, the maximum number of attempts to connect to a coordinator is hard coded to 4 in hs2-HTTP mode. From this release, you can configure the maximum number of attempts impala-shell can make using this option --connect_max_tries. The default value of this option is 4. After the number of attempts specified through this option, impala-shell returns with error "Not connected to Impala"
--hs2_fp_format hs2_fp_format=<a Python-based format specification expression which will get parsed and applied to floating-pointcolumn values>

Sets the printing format specification for floating point values when using HS2 protocol. The default behaviour makes the values handled by Python's str() built-in method. Use '16G' to match Beeswax protocol's floating-point output format.

--http_cookie_names http_cookie_names=KNOX_BACKEND-IMPALA This parameter has to be set to include the cookie that Knox uses for stateful connections. This is what the Knox enableStickySession=true uses. When using impala-shell and http mode, you must update the client connection string to include the cookie being used for session persistence using the `-http_cookie_names`. This config is needed for Active-Active HA in Impala.
--live_progress live_progress=true Prints a progress bar showing roughly the percentage complete for each query. Information is updated interactively as the query progresses.
--disable_live_progress live_progress=false Disables live_progress in the interactive mode.

--print_header

print_header=true

-o filename or

--output_file filename

output_file=filename

Stores all query results in the specified file. Typically used to store the results of a single query issued from the command line with the -q option. Also works for interactive sessions; you see the messages such as number of rows fetched, but not the actual result set. To suppress these incidental messages when combining the -q and -o options, redirect stderr to /dev/null.

--output_delimiter=

character

output_delimiter=character

Specifies the character to use as a delimiter between fields when query results are printed in plain format by the -B option. Defaults to tab ('\t'). If an output value contains the delimiter character, that field is quoted, escaped by doubling quotation marks, or both.

-p or

--show_profiles

show_profiles=true

Displays the query execution plan (same output as the EXPLAIN statement) and a more detailed low-level breakdown of execution steps, for every query executed by the shell.

--profile_format=

text | json | prettyjson

N/A json and prettyjson output the JSON representation of each profile in a dense single-line form and in a human-readable multi-line form respectively.

-h or

--help

N/A

Displays help information.

N/A

history_max=1000

Sets the maximum number of queries to store in the history file.

-i hostname or

--impalad=hostname[:portnum]

impalad=hostname[:portnum]

Connects to the impalad daemon on the specified host. The default port of 21050 is assumed unless you provide another value. You can connect to any host in your cluster that is running impalad. If you connect to an instance of impalad that was started with an alternate port specified by the --fe_port flag, provide that alternative port.

-q query or

--query=query

query=query

Passes a query or other impala-shell command from the command line. The impala-shell interpreter immediately exits after processing the statement. It is limited to a single statement, which could be a SELECT, CREATE TABLE, SHOW TABLES, or any other statement recognized in impala-shell. Because you cannot pass a USE statement and another query, fully qualify the names for any tables outside the default database. (Or use the -f option to pass a file with a USE statement followed by other queries.)

-f query_file or

--query_file=query_file

query_file=path_to_query_file

Passes a SQL query from a file. Multiple statements must be semicolon (;) delimited.

--query_option=

"option=value

-Q

"option=value"

Header line [impala.query_options], followed on subsequent lines by option=value, one option per line.

Sets default query options for an invocation of the impala-shell command. To set multiple query options at once, use more than one instance of this command-line option. The query option names are not case-sensitive.

-V or --verbose

verbose=true

Enables verbose output.

--quiet

verbose=false

Disables verbose output.

-v or --version

version=true

Displays version information.

-c

ignore_query_failure=true

Continues on query failure.

-d default_db or

--database=default_db

default_db=default_db

Specifies the database to be used on startup. Same as running the USE statement after connecting. If not specified, a database named DEFAULT is used.

--ssl ssl=true Enables TLS/SSL for impala-shell.

--http_socket_timeout_s

http_socket_timeout_s=HTTP_SOCKET_TIMEOUT_S Sets the timeout in seconds after which the socket will time out if the associated operation cannot be completed. Set to None to disable any timeout. This configurable option is only supported for hs2-http mode and the DEFAULT is NONE.
path_to_certificate ca_cert=path_to_certificate The local pathname pointing to the third-party CA certificate, or to a copy of the server certificate for self-signed server certificates. If --ca_cert is not set, impala-shell enables TLS/SSL, but does not validate the server certificate. This is useful for connecting to a known-good Impala that is only running over TLS/SSL, when a copy of the certificate is not available (such as when debugging customer installations).
-l use_ldap=true Enables LDAP authentication.
-u user=user_name Supplies the username, when LDAP authentication is enabled by the -l option. (Specify the short username, not the full LDAP distinguished name.) The shell then prompts interactively for the password.
--ldap_password_cmd=

command

N/A Specifies a command to run to retrieve the LDAP password, when LDAP authentication is enabled by the -l option. If the command includes space-separated arguments, enclose the command and its arguments in quotation marks.
-j, --jwt N/A Indicates that JWT authentication will be used when this command line option is specified in the impala-shell command.
--jwt_cmd N/A Shell command to run to retrieve the JWT to be used for authentication.
--config_file=

path_to_config_file

N/A Specifies the path of the file containing impala-shell configuration settings. The default is /etc/impalarc. This setting can only be specified on the command line.
--live_progress N/A Prints a progress bar showing roughly the percentage complete for each query. The information is updated interactively as the query progresses.
--live_summary N/A Prints a detailed report, similar to the SUMMARY command, showing progress details for each phase of query execution. The information is updated interactively as the query progresses.
--var=

variable_name=

value

N/A Defines a substitution variable that can be used within the impala-shell session. The variable can be substituted into statements processed by the -q or -f options, or in an interactive shell session. Within a SQL statement, you substitute the value by using the notation ${var:variable_name}.
--auth_creds_ok_in_clear N/A Allows LDAP authentication to be used with an insecure connection to the shell. WARNING: This will allow authentication credentials to be sent unencrypted, and hence may be vulnerable to an attack.
--protocol=

protocol

N/A Protocol to use for the connection to Impala.
Valid protocol values are:
  • 'hs2-http': Impala-shell uses HTTP transport to speak to the Impala Daemon via the HiveServer2 protocol.