Impala shell commands

You can use the commands described below to pass requests to an impalad daemon. It is possible to enter a command to the prompt, or pass it as the argument to the -q option of impala-shell. Most of these commands are passed to the Impala daemon as SQL statements. Refer to the corresponding sections of the Impala SQL Statements article for syntax details.

Impala shell commands
Name Description

alter

Changes the structure or settings of an Impala table, or a table shared between Impala and Hive. See ALTER TABLE and ALTER VIEW statements for details

compute stats

Displays performance-related information for a table. Impala uses it to optimize queries. See COMPUTE STATS Statement

connect

Connects to an instance of impalad. The command uses the default port 21000 for connections. If you connect to an instance of impalad that works on a different port, specify this port as a parameter. See Use impala-shell to connect to Impala

describe

Shows the column names, data types, and comments for a specified table. Also, the describe formatted command displays additional information such as the HDFS data directory, partitions, and internal properties for the table. You can use the abbreviation desc for the describe statement. See DESCRIBE Statement

drop

Removes an object, and in some cases its associated data files. See DROP TABLE, DROP VIEW, DROP DATABASE, and DROP FUNCTION statements for more information

explain

Provides the execution plan for a query. explain represents a query as a series of steps. These steps might be map/reduce stages, metastore operations, or file system operations (move or rename). See EXPLAIN Statement and Using the EXPLAIN Plan for Performance Tuning

help

Displays a list of all available commands and options

history

Shows an enumerated command history list from recent sessions. The history is stored in the ~/.impalahistory file

insert

Writes a query result to a specified table. This statement either overwrites table data or appends data to the existing table content. See INSERT Statement

invalidate metadata

Updates impalad metadata for tables. Use this command after creating, dropping, or altering databases, tables, or partitions in Hive. See INVALIDATE METADATA Statement

profile

Displays low-level information about the most recent query. It is used for performance diagnosis and tuning. The report starts with the same information as the EXPLAIN and SUMMARY reports. See Using the Query Profile for Performance Tuning

quit

Exits the impala-shell. It is necessary to add a final semicolon to the command so that the shell recognizes the end of the command

refresh

Refreshes impalad metadata of the HDFS block locations corresponding to Impala data files. Utilize this command after loading new data files into an Impala table through Hive or through HDFS commands. See REFRESH Statement

rerun or @

Executes a previous impala-shell command from the list of commands displayed by the history command. It can be an SQL statement, or a command specific to impala-shell (quit or profile).

The command accepts an integer argument. A positive integer number represents the command number from the history command output list. A negative integer -N represents the Nth command from the end of the list. For example, -1 executes the most recent command. Commands that are executed again do not produce new entries in the history output list

select

Selects data from a database. The returned result-set can be sent to the console output, or a file, or can be a part of another query. See SELECT Statement

set

Specifies query options for an impala-shell session. The available options are listed at Query Options for the SET Statement. These options are used for query tuning and troubleshooting. The command syntax is set <option>=<value>. If you need to display the current query options, run set without arguments. To modify an option value, run the command with a new value. To restore an option to its default, use the unset command. The set statement has no effect until impala-shell is connected to an impalad instance. You can also use the set as an SQL statement. See SET Statement

shell

Allows you to execute a command in the operating system shell without exiting from impala-shell. You can use the ! character as shorthand for the shell command. To embed comments within the source or ! commands, use the shell comment character # before a commented line

show

Displays metastore data for objects (databases, tables, and functions) created and accessed through Impala or Hive. See SHOW Statement

source or src

The command accepts as a parameter the path to a file on the local file system and executes statements from this file. The file can contain SQL statements and impala-shell commands, including other source commands.

The source command allows you to perform batch operations in the same way as impala-shell with the -f option, but in interactive mode. Each command or statement in the file, except the last one, must end with a semicolon. See Running Commands and SQL Statements in impala-shell

summary

Displays a summary of the operations performed at different stages of the query. It provides a higher-level view of the information displayed by the explain command. See Using the SUMMARY Report for Performance Tuning. You can also see a continuously updated report of the summary information while a query is in progress. See LIVE_SUMMARY Query Option

unset

Removes any user-specified value for a query option and returns the option to its default value. For information about the options for which this command is available, refer to Query Options for the SET Statement. You can also remove substitution variables. For this, use the following notation: unset var:<variable_name>

use

Specifies the database against which to execute subsequent commands. The use command allows you to avoid utilizing fully qualified names when you need to access a database other than the default one. See USE Statement

version

Displays Impala version information

Found a mistake? Seleсt text and press Ctrl+Enter to report it