You need to enable JavaScript to run this app.
E-MapReduce

E-MapReduce

Copy page
Download PDF
Basic usage
Impala basic operations
Copy page
Download PDF
Impala basic operations

This document describes basic operations for Impala, including creating databases, creating tables, writing data, and querying tables.

1 Prerequisites

  1. An E-MapReduce (EMR) cluster with the Impala component service has been created. For details, see 创建集群.
  2. Log in to the cluster's master-1 node using SSH, which is the node where statestored and catalogd are located. For details, see Log in to the cluster.
  3. Currently, the Impala component is available through an allowlist. You can apply for access using Impala basic operations.

2 Create a database

  1. After logging in to the cluster node, you can use the impala-shell command to access Impala:

tip

For Impala-shell command operations, refer to "Impala-shell tool".

root@emr-4nw5w1f78f3xxx-master-1:~# impala-shell 
/opt/emr/2.0.0/impala-3.4.1/shell/impala-shell-3.4.1-RELEASE/ext-py2/bitarray-0.9.0-py2.7-linux-x86_64.egg/bitarray/_bitarray.py:3: UserWarning: Module backports was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path
Starting Impala Shell without Kerberos authentication
Opened TCP connection to emr-4nw5w1f78f3xxx-master-1:21000
Connected to emr-4nw5w1f78f3xxx-master-1:21000
Server version: impalad version 3.4.1-RELEASE RELEASE (build eb1ed66fa435a722fa8c6a7c58ff53edc10c572e)
***********************************************************************************
Welcome to the Impala shell.
(Impala Shell v3.4.1-RELEASE (eb1ed66) built on Fri Sep 16 15:03:38 CST 2022)
 
Want to know what version of Impala you're connected to? Run the VERSION command to
find out!
***********************************************************************************
[emr-4nw5w1f78f3xxx-master-1:21000] default>
  1. Create a database
[emr-4nw5w1f78f3xxx-master-1:21000] default> create database first_db;
Query: create database first_db
+----------------------------+
| summary                    |
+----------------------------+
| Database has been created. |
+----------------------------+
Fetched 1 row(s) in 5.36s

3 Create a table

  1. Select a database
[emr-4nw5w1f78f3xxx-master-1:21000] default> use first_db;
Query: use first_db
  1. Create a table in Parquet format
[emr-4nw5w1f78f3xxx-master-1:21000] first_db> CREATE TABLE parquet_table ( id INT) STORED AS PARQUET;
Query: CREATE TABLE parquet_table ( id INT) STORED AS PARQUET
+-------------------------+
| summary                 |
+-------------------------+
| Table has been created. |
+-------------------------+
Fetched 1 row(s) in 5.26s

4 Write data

[emr-4nw5w1f78f3xxx-master-1:21000] first_db> insert into parquet_table values(1);
Query: insert into parquet_table values(1)
Query submitted at: 2022-10-17 16:52:34 (Coordinator: http://emr-4nw5w1f78f3xxx-core-1:25000)
Query progress can be monitored at: http://emr-4nw5w1f78f3xxx-core-1:25000/query_plan?query_id=8549b1a1cd09d63d:f8d8828f00000000
Modified 1 row(s) in 15.70s

5 Query data

[emr-4nw5w1f78f3xxx-master-1:21000] first_db> select * from parquet_table;
Query: select * from parquet_table
Query submitted at: 2022-10-17 16:53:10 (Coordinator: http://emr-4nw5w1f78f3xxx-core-1:25000)
Query progress can be monitored at: http://emr-4nw5w1f78f3xxx-core-1:25000/query_plan?query_id=5744559c2307a8b9:a411428400000000
+----+
| id |
+----+
| 1  |
+----+
Fetched 1 row(s) in 0.26s

6 Delete a table

[emr-4nw5w1f78f3xxx-master-1:21000] first_db> drop table parquet_table;
Query: drop table parquet_table
+-------------------------+
| summary                 |
+-------------------------+
| Table has been dropped. |
+-------------------------+
Fetched 1 row(s) in 5.23s
Last updated: 2026.06.01 16:22:17