SHOW Statement

The SHOW statement is a flexible way to get information about different types of Impala objects.

Syntax:

  1. SHOW DATABASES [[LIKE] 'pattern']
  2. SHOW SCHEMAS [[LIKE] 'pattern'] - an alias for SHOW DATABASES
  3. SHOW TABLES [IN database_name] [[LIKE] 'pattern']
  4. SHOW [AGGREGATE | ANALYTIC] FUNCTIONS [IN database_name] [[LIKE] 'pattern']
  5. SHOW CREATE TABLE [database_name].table_name
  6. SHOW CREATE VIEW [database_name].view_name
  7. SHOW TABLE STATS [database_name.]table_name
  8. SHOW COLUMN STATS [database_name.]table_name
  9. SHOW PARTITIONS [database_name.]table_name
  10. SHOW [RANGE] PARTITIONS [database_name.]table_name
  11. SHOW FILES IN [database_name.]table_name [PARTITION (key_col_expression [, key_col_expression]]
  12. SHOW ROLES
  13. SHOW CURRENT ROLES
  14. SHOW ROLE GRANT GROUP group_name
  15. SHOW GRANT USER user_name
  16. SHOW GRANT USER user_name ON SERVER
  17. SHOW GRANT USER user_name ON DATABASE database_name
  18. SHOW GRANT USER user_name ON TABLE database_name.table_name
  19. SHOW GRANT USER user_name ON URI uri
  20. SHOW GRANT USER user_name ON COLUMN database_name.table_name.column_name
  1. SHOW GRANT ROLE role_name
  2. SHOW GRANT ROLE role_name ON SERVER
  3. SHOW GRANT ROLE role_name ON DATABASE database_name
  4. SHOW GRANT ROLE role_name ON TABLE database_name.table_name
  5. SHOW GRANT ROLE role_name ON URI uri
  6. SHOW GRANT ROLE role_name ON COLUMN database_name.table_name.column_name
  1. SHOW GRANT GROUP group_name ON SERVER
  2. SHOW GRANT GROUP group_name ON DATABASE database_name
  3. SHOW GRANT GROUP group_name ON TABLE database_name.table_name
  4. SHOW GRANT GROUP group_name ON URI uri
  5. SHOW GRANT GROUP group_name ON COLUMN database_name.table_name.column_name

Issue a SHOW object_type statement to see the appropriate objects in the current database, or SHOW object_type IN database_name to see objects in a specific database.

The optional pattern argument is a quoted string literal, using Unix-style * wildcards and allowing | for alternation. The preceding LIKE keyword is also optional. All object names are stored in lowercase, so use all lowercase letters in the pattern string. For example:

  1. SHOW DATABASES 'a*';
  2. SHOW DATABASES LIKE 'a*';
  3. SHOW TABLES IN some_db LIKE '*fact*';
  4. USE some_db;
  5. SHOW TABLES '*dim*|*fact*';

Cancellation: Cannot be cancelled.

Parent topic: Impala SQL Statements

SHOW FILES Statement

The SHOW FILES statement displays the files that constitute a specified table, or a partition within a partitioned table. This syntax is available in Impala 2.2 and higher only. The output includes the names of the files, the size of each file, and the applicable partition for a partitioned table. The size includes a suffix of B for bytes, MB for megabytes, and GB for gigabytes.

In Impala 2.8 and higher, you can use general expressions with operators such as <, IN, LIKE, and BETWEEN in the PARTITION clause, instead of only equality operators. For example:

  1. show files in sample_table partition (j < 5);
  2. show files in sample_table partition (k = 3, l between 1 and 10);
  3. show files in sample_table partition (month like 'J%');

Note: This statement applies to tables and partitions stored on HDFS, or in the Amazon Simple Storage System (S3). It does not apply to views. It does not apply to tables mapped onto HBase or Kudu, because those data management systems do not use the same file-based storage layout.

Usage notes:

You can use this statement to verify the results of your ETL process: that is, that the expected files are present, with the expected sizes. You can examine the file information to detect conditions such as empty files, missing files, or inefficient layouts due to a large number of small files. When you use INSERT statements to copy from one table to another, you can see how the file layout changes due to file format conversions, compaction of small input files into large data blocks, and multiple output files from parallel queries and partitioned inserts.

The output from this statement does not include files that Impala considers to be hidden or invisible, such as those whose names start with a dot or an underscore, or that end with the suffixes .copying or .tmp.

The information for partitioned tables complements the output of the SHOW PARTITIONS statement, which summarizes information about each partition. SHOW PARTITIONS produces some output for each partition, while SHOW FILES does not produce any output for empty partitions because they do not include any data files.

HDFS permissions:

The user ID that the impalad daemon runs under, typically the impala user, must have read permission for all the table files, read and execute permission for all the directories that make up the table, and execute permission for the database directory and all its parent directories.

Examples:

The following example shows a SHOW FILES statement for an unpartitioned table using text format:

  1. [localhost:21000] > create table unpart_text (x bigint, s string);
  2. [localhost:21000] > insert into unpart_text (x, s) select id, name
  3. > from oreilly.sample_data limit 20e6;
  4. [localhost:21000] > show files in unpart_text;
  5. +--------------------------------------------------------------------------------------+----------+-----------+
  6. | path | size | partition |
  7. +--------------------------------------------------------------------------------------+----------+-----------+
  8. | hdfs://impala_data_dir/show_files.db/unpart_text/35665776ef85cfaf_1012432410_data.0. | 448.31MB | |
  9. +--------------------------------------------------------------------------------------+----------+-----------+
  10. [localhost:21000] > insert into unpart_text (x, s) select id, name from oreilly.sample_data limit 100e6;
  11. [localhost:21000] > show files in unpart_text;
  12. +--------------------------------------------------------------------------------------+----------+-----------+
  13. | path | size | partition |
  14. +--------------------------------------------------------------------------------------+----------+-----------+
  15. | hdfs://impala_data_dir/show_files.db/unpart_text/35665776ef85cfaf_1012432410_data.0. | 448.31MB | |
  16. | hdfs://impala_data_dir/show_files.db/unpart_text/ac3dba252a8952b8_1663177415_data.0. | 2.19GB | |
  17. +--------------------------------------------------------------------------------------+----------+-----------+

This example illustrates how, after issuing some INSERT ... VALUES statements, the table now contains some tiny files of just a few bytes. Such small files could cause inefficient processing of parallel queries that are expecting multi-megabyte input files. The example shows how you might compact the small files by doing an INSERT ... SELECT into a different table, possibly converting the data to Parquet in the process:

  1. [localhost:21000] > insert into unpart_text values (10,'hello'), (20, 'world');
  2. [localhost:21000] > insert into unpart_text values (-1,'foo'), (-1000, 'bar');
  3. [localhost:21000] > show files in unpart_text;
  4. +--------------------------------------------------------------------------------------+----------+-----------+
  5. | path | size | partition |
  6. +--------------------------------------------------------------------------------------+----------+-----------+
  7. | hdfs://impala_data_dir/show_files.db/unpart_text/4f11b8bdf8b6aa92_238145083_data.0. | 18B | |
  8. | hdfs://impala_data_dir/show_files.db/unpart_text/35665776ef85cfaf_1012432410_data.0. | 448.31MB | |
  9. | hdfs://impala_data_dir/show_files.db/unpart_text/ac3dba252a8952b8_1663177415_data.0. | 2.19GB | |
  10. | hdfs://impala_data_dir/show_files.db/unpart_text/cfb8252452445682_1868457216_data.0. | 17B | |
  11. +--------------------------------------------------------------------------------------+----------+-----------+
  12. [localhost:21000] > create table unpart_parq stored as parquet as select * from unpart_text;
  13. +---------------------------+
  14. | summary |
  15. +---------------------------+
  16. | Inserted 120000002 row(s) |
  17. +---------------------------+
  18. [localhost:21000] > show files in unpart_parq;
  19. +------------------------------------------------------------------------------------------+----------+
  20. | path | size |
  21. +------------------------------------------------------------------------------------------+----------+
  22. | hdfs://impala_data_dir/show_files.db/unpart_parq/60798d96ba630184_549959007_data.0.parq | 255.36MB |
  23. | hdfs://impala_data_dir/show_files.db/unpart_parq/60798d96ba630184_549959007_data.1.parq | 178.52MB |
  24. | hdfs://impala_data_dir/show_files.db/unpart_parq/60798d96ba630185_549959007_data.0.parq | 255.37MB |
  25. | hdfs://impala_data_dir/show_files.db/unpart_parq/60798d96ba630185_549959007_data.1.parq | 57.71MB |
  26. | hdfs://impala_data_dir/show_files.db/unpart_parq/60798d96ba630186_2141167244_data.0.parq | 255.40MB |
  27. | hdfs://impala_data_dir/show_files.db/unpart_parq/60798d96ba630186_2141167244_data.1.parq | 175.52MB |
  28. | hdfs://impala_data_dir/show_files.db/unpart_parq/60798d96ba630187_1006832086_data.0.parq | 255.40MB |
  29. | hdfs://impala_data_dir/show_files.db/unpart_parq/60798d96ba630187_1006832086_data.1.parq | 214.61MB |
  30. +------------------------------------------------------------------------------------------+----------+

The following example shows a SHOW FILES statement for a partitioned text table with data in two different partitions, and two empty partitions. The partitions with no data are not represented in the SHOW FILES output.

  1. [localhost:21000] > create table part_text (x bigint, y int, s string)
  2. > partitioned by (year bigint, month bigint, day bigint);
  3. [localhost:21000] > insert overwrite part_text (x, y, s) partition (year=2014,month=1,day=1)
  4. > select id, val, name from oreilly.normalized_parquet
  5. where id between 1 and 1000000;
  6. [localhost:21000] > insert overwrite part_text (x, y, s) partition (year=2014,month=1,day=2)
  7. > select id, val, name from oreilly.normalized_parquet
  8. > where id between 1000001 and 2000000;
  9. [localhost:21000] > alter table part_text add partition (year=2014,month=1,day=3);
  10. [localhost:21000] > alter table part_text add partition (year=2014,month=1,day=4);
  11. [localhost:21000] > show partitions part_text;
  12. +-------+-------+-----+-------+--------+---------+--------------+-------------------+--------+-------------------+
  13. | year | month | day | #Rows | #Files | Size | Bytes Cached | Cache Replication | Format | Incremental stats |
  14. +-------+-------+-----+-------+--------+---------+--------------+-------------------+--------+-------------------+
  15. | 2014 | 1 | 1 | -1 | 4 | 25.16MB | NOT CACHED | NOT CACHED | TEXT | false |
  16. | 2014 | 1 | 2 | -1 | 4 | 26.22MB | NOT CACHED | NOT CACHED | TEXT | false |
  17. | 2014 | 1 | 3 | -1 | 0 | 0B | NOT CACHED | NOT CACHED | TEXT | false |
  18. | 2014 | 1 | 4 | -1 | 0 | 0B | NOT CACHED | NOT CACHED | TEXT | false |
  19. | Total | | | -1 | 8 | 51.38MB | 0B | | | |
  20. +-------+-------+-----+-------+--------+---------+--------------+-------------------+--------+-------------------+
  21. [localhost:21000] > show files in part_text;
  22. +-----------------------------------------------------------------------------------------------------------------------+--------+-------------------------+
  23. | path | size | partition |
  24. +-----------------------------------------------------------------------------------------------------------------------+--------+-------------------------+
  25. | hdfs://<impala_data_dir>/show_files.db/part_text/year=2014/month=1/day=1/80732d9dc80689f_1418645991_data.0. | 5.77MB | year=2014/month=1/day=1 |
  26. | hdfs://<impala_data_dir>/show_files.db/part_text/year=2014/month=1/day=1/80732d9dc8068a0_1418645991_data.0. | 6.25MB | year=2014/month=1/day=1 |
  27. | hdfs://<impala_data_dir>/show_files.db/part_text/year=2014/month=1/day=1/80732d9dc8068a1_147082319_data.0. | 7.16MB | year=2014/month=1/day=1 |
  28. | hdfs://<impala_data_dir>/show_files.db/part_text/year=2014/month=1/day=1/80732d9dc8068a2_2111411753_data.0. | 5.98MB | year=2014/month=1/day=1 |
  29. | hdfs://<impala_data_dir>/show_files.db/part_text/year=2014/month=1/day=2/21a828cf494b5bbb_501271652_data.0. | 6.42MB | year=2014/month=1/day=2 |
  30. | hdfs://<impala_data_dir>/show_files.db/part_text/year=2014/month=1/day=2/21a828cf494b5bbc_501271652_data.0. | 6.62MB | year=2014/month=1/day=2 |
  31. | hdfs://<impala_data_dir>/show_files.db/part_text/year=2014/month=1/day=2/21a828cf494b5bbd_1393490200_data.0. | 6.98MB | year=2014/month=1/day=2 |
  32. | hdfs://<impala_data_dir>/show_files.db/part_text/year=2014/month=1/day=2/21a828cf494b5bbe_1393490200_data.0. | 6.20MB | year=2014/month=1/day=2 |
  33. +-----------------------------------------------------------------------------------------------------------------------+--------+-------------------------+

The following example shows a SHOW FILES statement for a partitioned Parquet table. The number and sizes of files are different from the equivalent partitioned text table used in the previous example, because INSERT operations for Parquet tables are parallelized differently than for text tables. (Also, the amount of data is so small that it can be written to Parquet without involving all the hosts in this 4-node cluster.)

  1. [localhost:21000] > create table part_parq (x bigint, y int, s string) partitioned by (year bigint, month bigint, day bigint) stored as parquet;
  2. [localhost:21000] > insert into part_parq partition (year,month,day) select x, y, s, year, month, day from partitioned_text;
  3. [localhost:21000] > show partitions part_parq;
  4. +-------+-------+-----+-------+--------+---------+--------------+-------------------+---------+-------------------+
  5. | year | month | day | #Rows | #Files | Size | Bytes Cached | Cache Replication | Format | Incremental stats |
  6. +-------+-------+-----+-------+--------+---------+--------------+-------------------+---------+-------------------+
  7. | 2014 | 1 | 1 | -1 | 3 | 17.89MB | NOT CACHED | NOT CACHED | PARQUET | false |
  8. | 2014 | 1 | 2 | -1 | 3 | 17.89MB | NOT CACHED | NOT CACHED | PARQUET | false |
  9. | Total | | | -1 | 6 | 35.79MB | 0B | | | |
  10. +-------+-------+-----+-------+--------+---------+--------------+-------------------+---------+-------------------+
  11. [localhost:21000] > show files in part_parq;
  12. +-----------------------------------------------------------------------------------------------+--------+-------------------------+
  13. | path | size | partition |
  14. +-----------------------------------------------------------------------------------------------+--------+-------------------------+
  15. | hdfs://impala_data_dir/show_files.db/part_parq/year=2014/month=1/day=1/1134113650_data.0.parq | 4.49MB | year=2014/month=1/day=1 |
  16. | hdfs://impala_data_dir/show_files.db/part_parq/year=2014/month=1/day=1/617567880_data.0.parq | 5.14MB | year=2014/month=1/day=1 |
  17. | hdfs://impala_data_dir/show_files.db/part_parq/year=2014/month=1/day=1/2099499416_data.0.parq | 8.27MB | year=2014/month=1/day=1 |
  18. | hdfs://impala_data_dir/show_files.db/part_parq/year=2014/month=1/day=2/945567189_data.0.parq | 8.80MB | year=2014/month=1/day=2 |
  19. | hdfs://impala_data_dir/show_files.db/part_parq/year=2014/month=1/day=2/2145850112_data.0.parq | 4.80MB | year=2014/month=1/day=2 |
  20. | hdfs://impala_data_dir/show_files.db/part_parq/year=2014/month=1/day=2/665613448_data.0.parq | 4.29MB | year=2014/month=1/day=2 |
  21. +-----------------------------------------------------------------------------------------------+--------+-------------------------+

The following example shows output from the SHOW FILES statement for a table where the data files are stored in Amazon S3:

  1. [localhost:21000] > show files in s3_testing.sample_data_s3;
  2. +-----------------------------------------------------------------------+---------+
  3. | path | size |
  4. +-----------------------------------------------------------------------+---------+
  5. | s3a://impala-demo/sample_data/e065453cba1988a6_1733868553_data.0.parq | 24.84MB |
  6. +-----------------------------------------------------------------------+---------+

SHOW ROLES Statement

The SHOW ROLES statement displays roles. This syntax is available in Impala 2.0 and later only, when you are using the Ranger authorization framework along with the Ranger service, as described in Managing Privileges.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

Examples:

Depending on the roles set up within your organization by the CREATE ROLE statement, the output might look something like this:

  1. show roles;
  2. +-----------+
  3. | role_name |
  4. +-----------+
  5. | analyst |
  6. | role1 |
  7. | sales |
  8. | superuser |
  9. | test_role |
  10. +-----------+

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

Related information:

Impala Authorization

SHOW CURRENT ROLES

The SHOW CURRENT ROLES statement displays roles assigned to the current user. This syntax is available in Impala 2.0 and later only, when you are using the Ranger authorization framework along with the Ranger service, as described in Managing Privileges.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

Examples:

Depending on the roles set up within your organization by the CREATE ROLE statement, the output might look something like this:

  1. show current roles;
  2. +-----------+
  3. | role_name |
  4. +-----------+
  5. | role1 |
  6. | superuser |
  7. +-----------+

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

Related information:

Impala Authorization

SHOW ROLE GRANT GROUP Statement

The SHOW ROLE GRANT GROUP statement lists all the roles assigned to the specified group. This statement is only allowed for Ranger administrative users and others users that are part of the specified group. This syntax is available in Impala 2.0 and later only, when you are using the Ranger authorization framework along with the Ranger service, as described in Managing Privileges.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

Related information:

Impala Authorization

SHOW GRANT ROLE Statement

The SHOW GRANT ROLE statement list all the grants for the given role name. This statement is only allowed for Ranger administrative users and other users that have been granted the specified role. This syntax is available in Impala 2.0 and later only, when you are using the Ranger authorization framework along with the Ranger service, as described in Managing Privileges.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

Related information:

Impala Authorization

SHOW GRANT USER Statement

The SHOW GRANT USER statement shows the list of privileges for a given user. This statement is only allowed for Ranger administrative users. However, the current user can run SHOW GRANT USER for themselves.

This syntax is available in Impala 3.1 and later only, when you are using the Ranger authorization framework along with the Ranger service, as described in Managing Privileges.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

Related information:

Impala Authorization

SHOW DATABASES

The SHOW DATABASES statement is often the first one you issue when connecting to an instance for the first time. You typically issue SHOW DATABASES to see the names you can specify in a USE db_name statement, then after switching to a database you issue SHOW TABLES to see the names you can specify in SELECT and INSERT statements.

In Impala 2.5 and higher, the output includes a second column showing any associated comment for each database.

The output of SHOW DATABASES includes the special _impala_builtins database, which lets you view definitions of built-in functions, as described under SHOW FUNCTIONS.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

Examples:

This example shows how you might locate a particular table on an unfamiliar system. The DEFAULT database is the one you initially connect to; a database with that name is present on every system. You can issue SHOW TABLES IN db_name without going into a database, or SHOW TABLES once you are inside a particular database.

  1. [localhost:21000] > show databases;
  2. +------------------+----------------------------------------------+
  3. | name | comment |
  4. +------------------+----------------------------------------------+
  5. | _impala_builtins | System database for Impala builtin functions |
  6. | default | Default Hive database |
  7. | file_formats | |
  8. +------------------+----------------------------------------------+
  9. Returned 3 row(s) in 0.02s
  10. [localhost:21000] > show tables in file_formats;
  11. +--------------------+
  12. | name |
  13. +--------------------+
  14. | parquet_table |
  15. | rcfile_table |
  16. | sequencefile_table |
  17. | textfile_table |
  18. +--------------------+
  19. Returned 4 row(s) in 0.01s
  20. [localhost:21000] > use file_formats;
  21. [localhost:21000] > show tables like '*parq*';
  22. +--------------------+
  23. | name |
  24. +--------------------+
  25. | parquet_table |
  26. +--------------------+
  27. Returned 1 row(s) in 0.01s

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

Related information:

Overview of Impala Databases, CREATE DATABASE Statement, DROP DATABASE Statement, USE Statement SHOW TABLES Statement, SHOW FUNCTIONS Statement

SHOW TABLES Statement

Displays the names of tables. By default, lists tables in the current database, or with the IN clause, in a specified database. By default, lists all tables, or with the LIKE clause, only those whose name match a pattern with * wildcards.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

The user ID that the impalad daemon runs under, typically the impala user, must have read and execute permissions for all directories that are part of the table. (A table could span multiple different HDFS directories if it is partitioned. The directories could be widely scattered because a partition can reside in an arbitrary HDFS directory based on its LOCATION attribute.)

Examples:

The following examples demonstrate the SHOW TABLES statement. If the database contains no tables, the result set is empty. If the database does contain tables, SHOW TABLES IN db_name lists all the table names. SHOW TABLES with no qualifiers lists all the table names in the current database.

  1. create database empty_db;
  2. show tables in empty_db;
  3. Fetched 0 row(s) in 0.11s
  4. create database full_db;
  5. create table full_db.t1 (x int);
  6. create table full_db.t2 like full_db.t1;
  7. show tables in full_db;
  8. +------+
  9. | name |
  10. +------+
  11. | t1 |
  12. | t2 |
  13. +------+
  14. use full_db;
  15. show tables;
  16. +------+
  17. | name |
  18. +------+
  19. | t1 |
  20. | t2 |
  21. +------+

This example demonstrates how SHOW TABLES LIKE 'wildcard_pattern' lists table names that match a pattern, or multiple alternative patterns. The ability to do wildcard matches for table names makes it helpful to establish naming conventions for tables to conveniently locate a group of related tables.

  1. create table fact_tbl (x int);
  2. create table dim_tbl_1 (s string);
  3. create table dim_tbl_2 (s string);
  4. /* Asterisk is the wildcard character. Only 2 out of the 3 just-created tables are returned. */
  5. show tables like 'dim*';
  6. +-----------+
  7. | name |
  8. +-----------+
  9. | dim_tbl_1 |
  10. | dim_tbl_2 |
  11. +-----------+
  12. /* We are already in the FULL_DB database, but just to be sure we can specify the database name also. */
  13. show tables in full_db like 'dim*';
  14. +-----------+
  15. | name |
  16. +-----------+
  17. | dim_tbl_1 |
  18. | dim_tbl_2 |
  19. +-----------+
  20. /* The pipe character separates multiple wildcard patterns. */
  21. show tables like '*dim*|t*';
  22. +-----------+
  23. | name |
  24. +-----------+
  25. | dim_tbl_1 |
  26. | dim_tbl_2 |
  27. | t1 |
  28. | t2 |
  29. +-----------+

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

Related information:

Overview of Impala Tables, CREATE TABLE Statement, ALTER TABLE Statement, DROP TABLE Statement, DESCRIBE Statement, SHOW CREATE TABLE Statement, SHOW TABLE STATS Statement, SHOW DATABASES, SHOW FUNCTIONS Statement

SHOW CREATE TABLE Statement

As a schema changes over time, you might run a CREATE TABLE statement followed by several ALTER TABLE statements. To capture the cumulative effect of all those statements, SHOW CREATE TABLE displays a CREATE TABLE statement that would reproduce the current structure of a table. You can use this output in scripts that set up or clone a group of tables, rather than trying to reproduce the original sequence of CREATE TABLE and ALTER TABLE statements. When creating variations on the original table, or cloning the original table on a different system, you might need to edit the SHOW CREATE TABLE output to change things such as the database name, LOCATION field, and so on that might be different on the destination system.

If you specify a view name in the SHOW CREATE TABLE, it returns a CREATE VIEW statement with column names and the original SQL statement to reproduce the view. You need the VIEW_METADATA privilege on the view and SELECT privilege on all underlying views and tables to successfully run the SHOW CREATE VIEW statement for a view. The SHOW CREATE VIEW is available as an alias for SHOW CREATE TABLE.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

For Kudu tables:

  • The column specifications include attributes such as NULL, NOT NULL, ENCODING, and COMPRESSION. If you do not specify those attributes in the original CREATE TABLE statement, the SHOW CREATE TABLE output displays the defaults that were used.

  • The specifications of any RANGE clauses are not displayed in full. To see the definition of the range clauses for a Kudu table, use the SHOW RANGE PARTITIONS statement.

  • The TBLPROPERTIES output reflects the Kudu master address and the internal Kudu name associated with the Impala table.

  1. show CREATE TABLE numeric_grades_default_letter;
  2. +------------------------------------------------------------------------------------------------+
  3. | result |
  4. +------------------------------------------------------------------------------------------------+
  5. | CREATE TABLE user.numeric_grades_default_letter ( |
  6. | score TINYINT NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION, |
  7. | letter_grade STRING NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION DEFAULT '-', |
  8. | student STRING NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION, |
  9. | PRIMARY KEY (score) |
  10. | ) |
  11. | PARTITION BY RANGE (score) (...) . |
  12. | STORED AS KUDU |
  13. | TBLPROPERTIES ('kudu.master_addresses'='vd0342.example.com:7051') |
  14. +------------------------------------------------------------------------------------------------+
  15. show range partitions numeric_grades_default_letter;
  16. +--------------------------+
  17. | RANGE (score) |
  18. +--------------------------+
  19. | 0 <= VALUES < 50 |
  20. | 50 <= VALUES < 65 |
  21. | 65 <= VALUES < 80 |
  22. | 80 <= VALUES < 100 |
  23. +--------------------------+

Examples:

The following example shows how various clauses from the CREATE TABLE statement are represented in the output of SHOW CREATE TABLE.

  1. create table show_create_table_demo (id int comment "Unique ID", y double, s string)
  2. partitioned by (year smallint)
  3. stored as parquet;
  4. show create table show_create_table_demo;
  5. +----------------------------------------------------------------------------------------+
  6. | result |
  7. +----------------------------------------------------------------------------------------+
  8. | CREATE TABLE scratch.show_create_table_demo ( |
  9. | id INT COMMENT 'Unique ID', |
  10. | y DOUBLE, |
  11. | s STRING |
  12. | ) |
  13. | PARTITIONED BY ( |
  14. | year SMALLINT |
  15. | ) |
  16. | STORED AS PARQUET |
  17. | LOCATION 'hdfs://127.0.0.1:8020/user/hive/warehouse/scratch.db/show_create_table_demo' |
  18. | TBLPROPERTIES ('transient_lastDdlTime'='1418152582') |
  19. +----------------------------------------------------------------------------------------+

The following example shows how, after a sequence of ALTER TABLE statements, the output from SHOW CREATE TABLE represents the current state of the table. This output could be used to create a matching table rather than executing the original CREATE TABLE and sequence of ALTER TABLE statements.

  1. alter table show_create_table_demo drop column s;
  2. alter table show_create_table_demo set fileformat textfile;
  3. show create table show_create_table_demo;
  4. +----------------------------------------------------------------------------------------+
  5. | result |
  6. +----------------------------------------------------------------------------------------+
  7. | CREATE TABLE scratch.show_create_table_demo ( |
  8. | id INT COMMENT 'Unique ID', |
  9. | y DOUBLE |
  10. | ) |
  11. | PARTITIONED BY ( |
  12. | year SMALLINT |
  13. | ) |
  14. | STORED AS TEXTFILE |
  15. | LOCATION 'hdfs://127.0.0.1:8020/user/hive/warehouse/demo.db/show_create_table_demo' |
  16. | TBLPROPERTIES ('transient_lastDdlTime'='1418152638') |
  17. +----------------------------------------------------------------------------------------+

Related information:

CREATE TABLE Statement, DESCRIBE Statement, SHOW TABLES Statement

SHOW CREATE VIEW Statement

The SHOW CREATE VIEW, it returns a CREATE VIEW statement with column names and the original SQL statement to reproduce the view. You need the VIEW_METADATA privilege on the view and SELECT privilege on all underlying views and tables to successfully run the SHOW CREATE VIEW statement for a view.

The SHOW CREATE VIEW is an alias for SHOW CREATE TABLE.

SHOW TABLE STATS Statement

The SHOW TABLE STATS and SHOW COLUMN STATS variants are important for tuning performance and diagnosing performance issues, especially with the largest tables and the most complex join queries.

Any values that are not available (because the COMPUTE STATS statement has not been run yet) are displayed as -1.

SHOW TABLE STATS provides some general information about the table, such as the number of files, overall size of the data, whether some or all of the data is in the HDFS cache, and the file format, that is useful whether or not you have run the COMPUTE STATS statement. A -1 in the #Rows output column indicates that the COMPUTE STATS statement has never been run for this table. If the table is partitioned, SHOW TABLE STATS provides this information for each partition. (It produces the same output as the SHOW PARTITIONS statement in this case.)

The output of SHOW COLUMN STATS is primarily only useful after the COMPUTE STATS statement has been run on the table. A -1 in the #Distinct Values output column indicates that the COMPUTE STATS statement has never been run for this table. Currently, Impala always leaves the #Nulls column as -1, even after COMPUTE STATS has been run.

These SHOW statements work on actual tables only, not on views.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

Kudu considerations:

Because Kudu tables do not have characteristics derived from HDFS, such as number of files and HDFS cache status, the output of SHOW TABLE STATS reflects different characteristics that apply to Kudu tables.

  1. show table stats kudu_table;
  2. +-------+-------------+---------+--------+------------------------------+
  3. | #Rows | #Partitions | Size | Format | Location |
  4. +-------+-------------+---------+--------+------------------------------+
  5. | 100 | 7 | 56.16MB | KUDU | kudu-master.example.com:7051 |
  6. +-------+-------------+---------+--------+------------------------------+

Examples:

The following examples show how the SHOW TABLE STATS statement displays physical information about a table and the associated data files:

  1. show table stats store_sales;
  2. +-------+--------+----------+--------------+--------+-------------------+
  3. | #Rows | #Files | Size | Bytes Cached | Format | Incremental stats |
  4. +-------+--------+----------+--------------+--------+-------------------+
  5. | -1 | 1 | 370.45MB | NOT CACHED | TEXT | false |
  6. +-------+--------+----------+--------------+--------+-------------------+
  7. show table stats customer;
  8. +-------+--------+---------+--------------+--------+-------------------+
  9. | #Rows | #Files | Size | Bytes Cached | Format | Incremental stats |
  10. +-------+--------+---------+--------------+--------+-------------------+
  11. | -1 | 1 | 12.60MB | NOT CACHED | TEXT | false |
  12. +-------+--------+---------+--------------+--------+-------------------+

The following example shows how, after a COMPUTE STATS or COMPUTE INCREMENTAL STATS statement, the #Rows field is now filled in. Because the STORE_SALES table in this example is not partitioned, the COMPUTE INCREMENTAL STATS statement produces regular stats rather than incremental stats, therefore the Incremental stats field remains false.

  1. compute stats customer;
  2. +------------------------------------------+
  3. | summary |
  4. +------------------------------------------+
  5. | Updated 1 partition(s) and 18 column(s). |
  6. +------------------------------------------+
  7. show table stats customer;
  8. +--------+--------+---------+--------------+--------+-------------------+
  9. | #Rows | #Files | Size | Bytes Cached | Format | Incremental stats |
  10. +--------+--------+---------+--------------+--------+-------------------+
  11. | 100000 | 1 | 12.60MB | NOT CACHED | TEXT | false |
  12. +--------+--------+---------+--------------+--------+-------------------+
  13. compute incremental stats store_sales;
  14. +------------------------------------------+
  15. | summary |
  16. +------------------------------------------+
  17. | Updated 1 partition(s) and 23 column(s). |
  18. +------------------------------------------+
  19. show table stats store_sales;
  20. +---------+--------+----------+--------------+--------+-------------------+
  21. | #Rows | #Files | Size | Bytes Cached | Format | Incremental stats |
  22. +---------+--------+----------+--------------+--------+-------------------+
  23. | 2880404 | 1 | 370.45MB | NOT CACHED | TEXT | false |
  24. +---------+--------+----------+--------------+--------+-------------------+

HDFS permissions:

The user ID that the impalad daemon runs under, typically the impala user, must have read and execute permissions for all directories that are part of the table. (A table could span multiple different HDFS directories if it is partitioned. The directories could be widely scattered because a partition can reside in an arbitrary HDFS directory based on its LOCATION attribute.) The Impala user must also have execute permission for the database directory, and any parent directories of the database directory in HDFS.

Related information:

COMPUTE STATS Statement, SHOW COLUMN STATS Statement

See Table and Column Statistics for usage information and examples.

SHOW COLUMN STATS Statement

The SHOW TABLE STATS and SHOW COLUMN STATS variants are important for tuning performance and diagnosing performance issues, especially with the largest tables and the most complex join queries.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

The output for SHOW COLUMN STATS includes the relevant information for Kudu tables. The information for column statistics that originates in the underlying Kudu storage layer is also represented in the metastore database that Impala uses.

Examples:

The following examples show the output of the SHOW COLUMN STATS statement for some tables, before the COMPUTE STATS statement is run. Impala deduces some information, such as maximum and average size for fixed-length columns, and leaves and unknown values as -1.

  1. show column stats customer;
  2. +------------------------+--------+------------------+--------+----------+----------+
  3. | Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size |
  4. +------------------------+--------+------------------+--------+----------+----------+
  5. | c_customer_sk | INT | -1 | -1 | 4 | 4 |
  6. | c_customer_id | STRING | -1 | -1 | -1 | -1 |
  7. | c_current_cdemo_sk | INT | -1 | -1 | 4 | 4 |
  8. | c_current_hdemo_sk | INT | -1 | -1 | 4 | 4 |
  9. | c_current_addr_sk | INT | -1 | -1 | 4 | 4 |
  10. | c_first_shipto_date_sk | INT | -1 | -1 | 4 | 4 |
  11. | c_first_sales_date_sk | INT | -1 | -1 | 4 | 4 |
  12. | c_salutation | STRING | -1 | -1 | -1 | -1 |
  13. | c_first_name | STRING | -1 | -1 | -1 | -1 |
  14. | c_last_name | STRING | -1 | -1 | -1 | -1 |
  15. | c_preferred_cust_flag | STRING | -1 | -1 | -1 | -1 |
  16. | c_birth_day | INT | -1 | -1 | 4 | 4 |
  17. | c_birth_month | INT | -1 | -1 | 4 | 4 |
  18. | c_birth_year | INT | -1 | -1 | 4 | 4 |
  19. | c_birth_country | STRING | -1 | -1 | -1 | -1 |
  20. | c_login | STRING | -1 | -1 | -1 | -1 |
  21. | c_email_address | STRING | -1 | -1 | -1 | -1 |
  22. | c_last_review_date | STRING | -1 | -1 | -1 | -1 |
  23. +------------------------+--------+------------------+--------+----------+----------+
  24. show column stats store_sales;
  25. +-----------------------+-------+------------------+--------+----------+----------+
  26. | Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size |
  27. +-----------------------+-------+------------------+--------+----------+----------+
  28. | ss_sold_date_sk | INT | -1 | -1 | 4 | 4 |
  29. | ss_sold_time_sk | INT | -1 | -1 | 4 | 4 |
  30. | ss_item_sk | INT | -1 | -1 | 4 | 4 |
  31. | ss_customer_sk | INT | -1 | -1 | 4 | 4 |
  32. | ss_cdemo_sk | INT | -1 | -1 | 4 | 4 |
  33. | ss_hdemo_sk | INT | -1 | -1 | 4 | 4 |
  34. | ss_addr_sk | INT | -1 | -1 | 4 | 4 |
  35. | ss_store_sk | INT | -1 | -1 | 4 | 4 |
  36. | ss_promo_sk | INT | -1 | -1 | 4 | 4 |
  37. | ss_ticket_number | INT | -1 | -1 | 4 | 4 |
  38. | ss_quantity | INT | -1 | -1 | 4 | 4 |
  39. | ss_wholesale_cost | FLOAT | -1 | -1 | 4 | 4 |
  40. | ss_list_price | FLOAT | -1 | -1 | 4 | 4 |
  41. | ss_sales_price | FLOAT | -1 | -1 | 4 | 4 |
  42. | ss_ext_discount_amt | FLOAT | -1 | -1 | 4 | 4 |
  43. | ss_ext_sales_price | FLOAT | -1 | -1 | 4 | 4 |
  44. | ss_ext_wholesale_cost | FLOAT | -1 | -1 | 4 | 4 |
  45. | ss_ext_list_price | FLOAT | -1 | -1 | 4 | 4 |
  46. | ss_ext_tax | FLOAT | -1 | -1 | 4 | 4 |
  47. | ss_coupon_amt | FLOAT | -1 | -1 | 4 | 4 |
  48. | ss_net_paid | FLOAT | -1 | -1 | 4 | 4 |
  49. | ss_net_paid_inc_tax | FLOAT | -1 | -1 | 4 | 4 |
  50. | ss_net_profit | FLOAT | -1 | -1 | 4 | 4 |
  51. +-----------------------+-------+------------------+--------+----------+----------+

The following examples show the output of the SHOW COLUMN STATS statement for some tables, after the COMPUTE STATS statement is run. Now most of the -1 values are changed to reflect the actual table data. The #Nulls column remains -1 because Impala does not use the number of NULL values to influence query planning.

  1. compute stats customer;
  2. +------------------------------------------+
  3. | summary |
  4. +------------------------------------------+
  5. | Updated 1 partition(s) and 18 column(s). |
  6. +------------------------------------------+
  7. compute stats store_sales;
  8. +------------------------------------------+
  9. | summary |
  10. +------------------------------------------+
  11. | Updated 1 partition(s) and 23 column(s). |
  12. +------------------------------------------+
  13. show column stats customer;
  14. +------------------------+--------+------------------+--------+----------+--------+
  15. | Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size
  16. +------------------------+--------+------------------+--------+----------+--------+
  17. | c_customer_sk | INT | 139017 | -1 | 4 | 4 |
  18. | c_customer_id | STRING | 111904 | -1 | 16 | 16 |
  19. | c_current_cdemo_sk | INT | 95837 | -1 | 4 | 4 |
  20. | c_current_hdemo_sk | INT | 8097 | -1 | 4 | 4 |
  21. | c_current_addr_sk | INT | 57334 | -1 | 4 | 4 |
  22. | c_first_shipto_date_sk | INT | 4374 | -1 | 4 | 4 |
  23. | c_first_sales_date_sk | INT | 4409 | -1 | 4 | 4 |
  24. | c_salutation | STRING | 7 | -1 | 4 | 3.1308 |
  25. | c_first_name | STRING | 3887 | -1 | 11 | 5.6356 |
  26. | c_last_name | STRING | 4739 | -1 | 13 | 5.9106 |
  27. | c_preferred_cust_flag | STRING | 3 | -1 | 1 | 0.9656 |
  28. | c_birth_day | INT | 31 | -1 | 4 | 4 |
  29. | c_birth_month | INT | 12 | -1 | 4 | 4 |
  30. | c_birth_year | INT | 71 | -1 | 4 | 4 |
  31. | c_birth_country | STRING | 205 | -1 | 20 | 8.4001 |
  32. | c_login | STRING | 1 | -1 | 0 | 0 |
  33. | c_email_address | STRING | 94492 | -1 | 46 | 26.485 |
  34. | c_last_review_date | STRING | 349 | -1 | 7 | 6.7561 |
  35. +------------------------+--------+------------------+--------+----------+--------+
  36. show column stats store_sales;
  37. +-----------------------+-------+------------------+--------+----------+----------+
  38. | Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size |
  39. +-----------------------+-------+------------------+--------+----------+----------+
  40. | ss_sold_date_sk | INT | 4395 | -1 | 4 | 4 |
  41. | ss_sold_time_sk | INT | 63617 | -1 | 4 | 4 |
  42. | ss_item_sk | INT | 19463 | -1 | 4 | 4 |
  43. | ss_customer_sk | INT | 122720 | -1 | 4 | 4 |
  44. | ss_cdemo_sk | INT | 242982 | -1 | 4 | 4 |
  45. | ss_hdemo_sk | INT | 8097 | -1 | 4 | 4 |
  46. | ss_addr_sk | INT | 70770 | -1 | 4 | 4 |
  47. | ss_store_sk | INT | 6 | -1 | 4 | 4 |
  48. | ss_promo_sk | INT | 355 | -1 | 4 | 4 |
  49. | ss_ticket_number | INT | 304098 | -1 | 4 | 4 |
  50. | ss_quantity | INT | 105 | -1 | 4 | 4 |
  51. | ss_wholesale_cost | FLOAT | 9600 | -1 | 4 | 4 |
  52. | ss_list_price | FLOAT | 22191 | -1 | 4 | 4 |
  53. | ss_sales_price | FLOAT | 20693 | -1 | 4 | 4 |
  54. | ss_ext_discount_amt | FLOAT | 228141 | -1 | 4 | 4 |
  55. | ss_ext_sales_price | FLOAT | 433550 | -1 | 4 | 4 |
  56. | ss_ext_wholesale_cost | FLOAT | 406291 | -1 | 4 | 4 |
  57. | ss_ext_list_price | FLOAT | 574871 | -1 | 4 | 4 |
  58. | ss_ext_tax | FLOAT | 91806 | -1 | 4 | 4 |
  59. | ss_coupon_amt | FLOAT | 228141 | -1 | 4 | 4 |
  60. | ss_net_paid | FLOAT | 493107 | -1 | 4 | 4 |
  61. | ss_net_paid_inc_tax | FLOAT | 653523 | -1 | 4 | 4 |
  62. | ss_net_profit | FLOAT | 611934 | -1 | 4 | 4 |
  63. +-----------------------+-------+------------------+--------+----------+----------+

HDFS permissions:

The user ID that the impalad daemon runs under, typically the impala user, must have read and execute permissions for all directories that are part of the table. (A table could span multiple different HDFS directories if it is partitioned. The directories could be widely scattered because a partition can reside in an arbitrary HDFS directory based on its LOCATION attribute.) The Impala user must also have execute permission for the database directory, and any parent directories of the database directory in HDFS.

Related information:

COMPUTE STATS Statement, SHOW TABLE STATS Statement

See Table and Column Statistics for usage information and examples.

SHOW PARTITIONS Statement

SHOW PARTITIONS displays information about each partition for a partitioned table. (The output is the same as the SHOW TABLE STATS statement, but SHOW PARTITIONS only works on a partitioned table.) Because it displays table statistics for all partitions, the output is more informative if you have run the COMPUTE STATS statement after creating all the partitions. See COMPUTE STATS Statement for details. For example, on a CENSUS table partitioned on the YEAR column:

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

Kudu considerations:

The optional RANGE clause only applies to Kudu tables. It displays only the partitions defined by the RANGE clause of CREATE TABLE or ALTER TABLE.

Although you can specify < or <= comparison operators when defining range partitions for Kudu tables, Kudu rewrites them if necessary to represent each range as low_bound <= VALUES < high_bound. This rewriting might involve incrementing one of the boundary values or appending a \0 for string values, so that the partition covers the same range as originally specified.

Examples:

The following example shows the output for a Parquet, text, or other HDFS-backed table partitioned on the YEAR column:

  1. [localhost:21000] > show partitions census;
  2. +-------+-------+--------+------+---------+
  3. | year | #Rows | #Files | Size | Format |
  4. +-------+-------+--------+------+---------+
  5. | 2000 | -1 | 0 | 0B | TEXT |
  6. | 2004 | -1 | 0 | 0B | TEXT |
  7. | 2008 | -1 | 0 | 0B | TEXT |
  8. | 2010 | -1 | 0 | 0B | TEXT |
  9. | 2011 | 4 | 1 | 22B | TEXT |
  10. | 2012 | 4 | 1 | 22B | TEXT |
  11. | 2013 | 1 | 1 | 231B | PARQUET |
  12. | Total | 9 | 3 | 275B | |
  13. +-------+-------+--------+------+---------+

The following example shows the output for a Kudu table using the hash partitioning mechanism. The number of rows in the result set corresponds to the values used in the PARTITIONS N clause of CREATE TABLE. If the Kudu table is created with the clause PARTITIONS 20, then the result set of SHOW PARTITIONS consists of 20 rows, each representing one of the numbered partitions. For example:

  1. show partitions million_rows_hash;
  2. +--------+-----------+----------+-----------------------+------------+
  3. | # Rows | Start Key | Stop Key | Leader Replica | # Replicas |
  4. +--------+-----------+----------+-----------------------+------------+
  5. | -1 | | 00000001 | n236.example.com:7050 | 3 |
  6. | -1 | 00000001 | 00000002 | n236.example.com:7050 | 3 |
  7. | -1 | 00000002 | 00000003 | n336.example.com:7050 | 3 |
  8. | -1 | 00000003 | 00000004 | n238.example.com:7050 | 3 |
  9. | -1 | 00000004 | 00000005 | n338.example.com:7050 | 3 |
  10. ...
  11. | -1 | 0000002E | 0000002F | n240.example.com:7050 | 3 |
  12. | -1 | 0000002F | 00000030 | n336.example.com:7050 | 3 |
  13. | -1 | 00000030 | 00000031 | n240.example.com:7050 | 3 |
  14. | -1 | 00000031 | | n334.example.com:7050 | 3 |
  15. +--------+-----------+----------+-----------------------+------------+
  16. Fetched 50 row(s) in 0.05s

Impala only computes the number of rows for the whole Kudu table, partition level row counts are not available.

The following example shows the output for a Kudu table using the range partitioning mechanism:

  1. show range partitions million_rows_range;
  2. +-----------------------+
  3. | RANGE (id) |
  4. +-----------------------+
  5. | VALUES < "A" |
  6. | "A" <= VALUES < "[" |
  7. | "a" <= VALUES < "{" |
  8. | "{" <= VALUES < "~\0" |
  9. +-----------------------+

HDFS permissions:

The user ID that the impalad daemon runs under, typically the impala user, must have read and execute permissions for all directories that are part of the table. (A table could span multiple different HDFS directories if it is partitioned. The directories could be widely scattered because a partition can reside in an arbitrary HDFS directory based on its LOCATION attribute.) The Impala user must also have execute permission for the database directory, and any parent directories of the database directory in HDFS.

Related information:

See Table and Column Statistics for usage information and examples.

SHOW TABLE STATS Statement, Partitioning for Impala Tables

SHOW FUNCTIONS Statement

By default, SHOW FUNCTIONS displays user-defined functions (UDFs) and SHOW AGGREGATE FUNCTIONS displays user-defined aggregate functions (UDAFs) associated with a particular database. The output from SHOW FUNCTIONS includes the argument signature of each function. You specify this argument signature as part of the DROP FUNCTION statement. You might have several UDFs with the same name, each accepting different argument data types.

Usage notes:

In Impala 2.5 and higher, the SHOW FUNCTIONS output includes a new column, labelled is persistent. This property is true for Impala built-in functions, C++ UDFs, and Java UDFs created using the new CREATE FUNCTION syntax with no signature. It is false for Java UDFs created using the old CREATE FUNCTION syntax that includes the types for the arguments and return value. Any functions with false shown for this property must be created again by the CREATE FUNCTION statement each time the Impala catalog server is restarted. See CREATE FUNCTION for information on switching to the new syntax, so that Java UDFs are preserved across restarts. Java UDFs that are persisted this way are also easier to share across Impala and Hive.

Security considerations:

When authorization is enabled, the output of the SHOW statement only shows those objects for which you have the privilege to view. If you believe an object exists but you cannot see it in the SHOW output, check with the system administrator if you need to be granted a new privilege for that object. See Impala Authorization for how to set up authorization and add privileges for specific objects.

HDFS permissions: This statement does not touch any HDFS files or directories, therefore no HDFS permissions are required.

Examples:

To display Impala built-in functions, specify the special database name _impala_builtins:

  1. show functions in _impala_builtins;
  2. +--------------+-------------------------------------------------+-------------+---------------+
  3. | return type | signature | binary type | is persistent |
  4. +--------------+-------------------------------------------------+-------------+---------------+
  5. | BIGINT | abs(BIGINT) | BUILTIN | true |
  6. | DECIMAL(*,*) | abs(DECIMAL(*,*)) | BUILTIN | true |
  7. | DOUBLE | abs(DOUBLE) | BUILTIN | true |
  8. | FLOAT | abs(FLOAT) | BUILTIN | true |
  9. +----------------+-----------------------------------------------+-------------+---------------+
  10. show functions in _impala_builtins like '*week*';
  11. +-------------+------------------------------+-------------+---------------+
  12. | return type | signature | binary type | is persistent |
  13. +-------------+------------------------------+-------------+---------------+
  14. | INT | dayofweek(TIMESTAMP) | BUILTIN | true |
  15. | INT | weekofyear(TIMESTAMP) | BUILTIN | true |
  16. | TIMESTAMP | weeks_add(TIMESTAMP, BIGINT) | BUILTIN | true |
  17. | TIMESTAMP | weeks_add(TIMESTAMP, INT) | BUILTIN | true |
  18. | TIMESTAMP | weeks_sub(TIMESTAMP, BIGINT) | BUILTIN | true |
  19. | TIMESTAMP | weeks_sub(TIMESTAMP, INT) | BUILTIN | true |
  20. +-------------+------------------------------+-------------+---------------+

Related information:

Overview of Impala Functions, Impala Built-In Functions, User-Defined Functions (UDFs), SHOW DATABASES, SHOW TABLES Statement