impala-shell Command-Line Options
You can specify the following command-line options when starting the impala-shell command to change how shell commands are executed.
These options are different than the configuration options for the impalad daemon itself. For the impalad options, see Modifying Impala Startup Options.
Option |
Explanation |
---|---|
-B or --delimited |
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. Added in Impala 1.0.1. |
--print_header |
|
-o filename or --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. Added in Impala 1.0.1. |
--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 and/or escaped. Added in Impala 1.0.1. |
-p or --show_profiles |
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. |
-h or --help |
Displays help information. |
-i hostname or --impalad=hostname |
Connects to the impalad daemon on the specified host. The default port of 21000 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 |
Passes a query or other shell command from the command line. The shell 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 |
Passes a SQL query from a file. Files must be semicolon (;) delimited. |
-k or --kerberos |
Kerberos authentication is used when the shell connects to impalad. If Kerberos is not enabled on the instance of impalad to which you are connecting, errors are displayed. |
-s kerberos_service_name or --kerberos_service_name=name |
Instructs impala-shell to authenticate to a particular impalad service principal. If a kerberos_service_name is not specified, impala is used by default. If this option is used in conjunction with a connection in which Kerberos is not supported, errors are returned. |
-V or --verbose |
Enables verbose output. |
--quiet |
Disables verbose output. |
-v or --version |
Displays version information. |
-c |
Continues on query failure. |
-r or --refresh_after_connect |
Refreshes Impala metadata upon connection. Same as running the REFRESH statement after connecting. |
-d default_db or --database=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. |
-l | Enables LDAP authentication. |
-u | Supplies the user name, when LDAP authentication is enabled by the -l option. (Specify the short user name, not the full LDAP distinguished name.) The shell then prompts interactively for the password. |
<< Using the Impala Shell (impala-shell Command) | Connecting to impalad through impala-shell >> | |