Impala Shell - Apache Impala

What is Impala Shell?

In the earlier chapters, we've got seen the set up of Impala using Cloudera and its architecture.

  • Impala shell (command prompt)
  • Hue (User Interface)
  • ODBC and JDBC (third party libraries)

This chapter explains a way to begin Impala Shell and the various options of the shell.

Impala Shell Command Reference

The commands of Impala shell are classified as general commands, query specific options, and table and database specific options, as explained below.

  • General Commands
    • help
    • version
    • history
    • shell (or) !
    • connect
    • exit | quit
  • Query specific options
    • Set/unset
    • Profile
    • Explain

Table and Database specific options

  • Alter
  • describe
  • drop
  • insert
  • select
  • show
  • use
  • Starting Impala Shell

Open the cloudera terminal, sign in as superuser, and type cloudera as password as shown below.

Start Impala shell by typing the following command −

Impala – General Purpose Commands

The general purpose commands of Impala are explained below −

help command

The help command of Impala shell gives you a list of the commands available in Impala −

version command

The version command gives you the current version of Impala, as shown below.

History command

The history command of Impala displays the last 10 commands executed in the shell. Following is the example of the history command. Here we have executed 5 commands, namely, version, help, show, use, and history.

quit/exit command

You can come out of the Impala shell using the quit or exit command, as shown below.

connect command

The connect command is used to connect to a given instance of Impala. In case you do not specify any instance, then it connects to the default port 21000 as shown below.

Impala Query Specific Options

The query specific commands of Impala accept a query. They are explained below −

Explain

The explain command returns the execution plan for the given query.

Profile

The profile command displays the low-level information about the recent query. This command is used for diagnosis and performance tuning of a query. Following is the example of a profile command. In this scenario, the profile command returns the low-level information of explain query.

Table and Database Specific Options

The following table lists out the table and data specific options in Impala.

Sr.No Command & Explanation
1

Alter

Thealtercommand is used to change the structure and name of a table in Impala.

2

Describe

Thedescribecommand of Impala gives the metadata of a table. It contains the information like columns and their data types. Thedescribecommand hasdescas a short cut.

3

Drop

Thedropcommand is used to remove a construct from Impala, where a construct can be a table, a view, or a database function.

4

insert

Theinsertcommand of Impala is used to,

  • Append data (columns) into a table.
  • Override the data of an existing table.
  • Override the data of an existing table.
5

select

Theselectstatement is used to perform a desired operation on a particular dataset. It specifies the dataset on which to complete some action. You can print or store (in a file) the result of the select statement.

6

show

Theshowstatement of Impala is used to display the metastore of various constructs such as tables, databases, and tables.

7

use

Theusestatement of Impala is used to change the current context to the desired database.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Apache Impala Topics