Use the up-arrow and down-arrow keys to cycle through and edit previous commands.
impala-shell uses the readline library and so supports a standard set of
keyboard shortcuts for editing and cursor movement, such as Ctrl-A for beginning of line and
Ctrl-E for end of line.

In Impala 2.5 and higher, you can define substitution variables to be used within SQL statements
processed by impala-shell. On the command line, you specify the option
--var=variable_name=value.
Within an interactive session or a script file processed by the -f option, you specify
a SET command using the notation SET VAR:variable_name=value.
Within a SQL statement, you substitute the value by using the notation ${var:variable_name}.

Note:
Because this feature is part of impala-shell rather than the impalad
backend, make sure the client system you are connecting from has the most recent impala-shell.
You can use this feature with a new impala-shell connecting to an older impalad,
but not the reverse.

For example, here are some impala-shell commands that define substitution variables and then
use them in SQL statements executed through the -q and -f options.
Notice how the -q argument strings are single-quoted to prevent shell expansion of the
${var:value} notation, and any string literals within the queries are enclosed by double quotation marks.

Here is a substitution variable passed in by the --var option,
and then referenced by statements issued interactively. Then the variable is
cleared with the UNSET command, and defined again with the
SET command.

The following example shows how a file that is run by the SOURCE command,
or through the -q or -f options of impala-shell,
can contain additional SOURCE commands.
The first file, nested1.sql, runs an impala-shell command
and then also runs the commands from nested2.sql.
This ability for scripts to call each other is often useful for code that sets up schemas for applications
or test environments.