Files
impala/docs/build/plain-html/topics/impala_show.html
Peter Rozsa 0b571b5cf4 Add 4.5.0 changelog and docs
Change-Id: I07ec0a197de8a625788a3b0485d5ecf237e554ba
Reviewed-on: http://gerrit.cloudera.org:8080/22576
Reviewed-by: Zoltan Borok-Nagy <boroknagyz@cloudera.com>
Tested-by: Peter Rozsa <prozsa@cloudera.com>
2025-03-04 16:12:35 +00:00

1820 lines
94 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="copyright" content="(C) Copyright 2025" />
<meta name="DC.rights.owner" content="(C) Copyright 2025" />
<meta name="DC.Type" content="concept" />
<meta name="DC.Title" content="SHOW Statement" />
<meta name="DC.Relation" scheme="URI" content="../topics/impala_langref_sql.html" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="prodname" content="Impala" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="version" content="Impala 3.4.x" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="show" />
<link rel="stylesheet" type="text/css" href="../commonltr.css" />
<title>SHOW Statement</title>
</head>
<body id="show">
<h1 class="title topictitle1" id="ariaid-title1">SHOW Statement</h1>
<div class="body conbody">
<p class="p"> The <code class="ph codeph">SHOW</code> statement is a flexible way to get information
about different types of Impala objects. </p>
<p class="p">
<strong class="ph b">Syntax:</strong>
</p>
<pre class="pre codeblock"><code>SHOW DATABASES [[LIKE] '<var class="keyword varname">pattern</var>']
SHOW SCHEMAS [[LIKE] '<var class="keyword varname">pattern</var>'] - an alias for SHOW DATABASES
SHOW TABLES [IN <var class="keyword varname">database_name</var>] [[LIKE] '<var class="keyword varname">pattern</var>']
<span class="ph">SHOW [AGGREGATE | ANALYTIC] FUNCTIONS [IN <var class="keyword varname">database_name</var>] [[LIKE] '<var class="keyword varname">pattern</var>']</span>
<span class="ph">SHOW CREATE TABLE [<var class="keyword varname">database_name</var>].<var class="keyword varname">table_name</var></span>
<span class="ph">SHOW CREATE VIEW [<var class="keyword varname">database_name</var>].<var class="keyword varname">view_name</var></span>
<span class="ph">SHOW TABLE STATS [<var class="keyword varname">database_name</var>.]<var class="keyword varname">table_name</var></span>
<span class="ph">SHOW COLUMN STATS [<var class="keyword varname">database_name</var>.]<var class="keyword varname">table_name</var></span>
<span class="ph">SHOW PARTITIONS [<var class="keyword varname">database_name</var>.]<var class="keyword varname">table_name</var></span>
<span class="ph">SHOW <span class="ph">[RANGE]</span> PARTITIONS [<var class="keyword varname">database_name</var>.]<var class="keyword varname">table_name</var></span>
SHOW FILES IN [<var class="keyword varname">database_name</var>.]<var class="keyword varname">table_name</var> <span class="ph">[PARTITION (<var class="keyword varname">key_col_expression</var> [, <var class="keyword varname">key_col_expression</var>]</span>]
<span class="ph">SHOW ROLES
SHOW CURRENT ROLES
SHOW ROLE GRANT GROUP <var class="keyword varname">group_name</var></span>
<span class="ph">SHOW GRANT USER <var class="keyword varname">user_name</var>
SHOW GRANT USER <var class="keyword varname">user_name</var> ON SERVER
SHOW GRANT USER <var class="keyword varname">user_name</var> ON DATABASE <var class="keyword varname">database_name</var>
SHOW GRANT USER <var class="keyword varname">user_name</var> ON TABLE <var class="keyword varname">database_name.table_name</var>
SHOW GRANT USER <var class="keyword varname">user_name</var> ON URI <var class="keyword varname">uri</var></span>
SHOW GRANT USER <var class="keyword varname">user_name</var> ON COLUMN <var class="keyword varname">database_name.table_name.column_name</var></code></pre>
<pre class="pre codeblock"><code>SHOW GRANT ROLE <var class="keyword varname">role_name</var>
SHOW GRANT ROLE <var class="keyword varname">role_name</var> ON SERVER
SHOW GRANT ROLE <var class="keyword varname">role_name</var> ON DATABASE <var class="keyword varname">database_name</var>
SHOW GRANT ROLE <var class="keyword varname">role_name</var> ON TABLE <var class="keyword varname">database_name.table_name</var>
SHOW GRANT ROLE <var class="keyword varname">role_name</var> ON URI <var class="keyword varname">uri</var>
SHOW GRANT ROLE <var class="keyword varname">role_name</var> ON COLUMN <var class="keyword varname">database_name.table_name.column_name</var></code></pre>
<pre class="pre codeblock"><code>SHOW GRANT GROUP <var class="keyword varname">group_name</var> ON SERVER
SHOW GRANT GROUP <var class="keyword varname">group_name</var> ON DATABASE <var class="keyword varname">database_name</var>
SHOW GRANT GROUP <var class="keyword varname">group_name</var> ON TABLE <var class="keyword varname">database_name.table_name</var>
SHOW GRANT GROUP <var class="keyword varname">group_name</var> ON URI <var class="keyword varname">uri</var>
SHOW GRANT GROUP <var class="keyword varname">group_name</var> ON COLUMN <var class="keyword varname">database_name.table_name.column_name</var></code></pre>
<p class="p"> Issue a <code class="ph codeph">SHOW <var class="keyword varname">object_type</var></code> statement
to see the appropriate objects in the current database, or <code class="ph codeph">SHOW
<var class="keyword varname">object_type</var> IN
<var class="keyword varname">database_name</var></code> to see objects in a specific
database. </p>
<p class="p"> The optional <var class="keyword varname">pattern</var> argument is a quoted string
literal, using Unix-style <code class="ph codeph">*</code> wildcards and allowing
<code class="ph codeph">|</code> for alternation. The preceding <code class="ph codeph">LIKE</code>
keyword is also optional. All object names are stored in lowercase, so use
all lowercase letters in the pattern string. For example: </p>
<pre class="pre codeblock"><code>SHOW DATABASES 'a*';
SHOW DATABASES LIKE 'a*';
SHOW TABLES IN some_db LIKE '*fact*';
USE some_db;
SHOW TABLES '*dim*|*fact*';</code></pre>
<p class="p">
<strong class="ph b">Cancellation:</strong> Cannot be cancelled.
</p>
<p class="p toc inpage"></p>
</div>
<div class="related-links">
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../topics/impala_langref_sql.html">Impala SQL Statements</a></div>
</div>
</div><div class="topic concept nested1" aria-labelledby="ariaid-title2" id="show_files">
<h2 class="title topictitle2" id="ariaid-title2">SHOW FILES Statement</h2>
<div class="body conbody">
<p class="p">
The <code class="ph codeph">SHOW FILES</code> statement displays the files that constitute a specified table,
or a partition within a partitioned table. This syntax is available in <span class="keyword">Impala 2.2</span> 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 <code class="ph codeph">B</code> for bytes,
<code class="ph codeph">MB</code> for megabytes, and <code class="ph codeph">GB</code> for gigabytes.
</p>
<div class="p">
In <span class="keyword">Impala 2.8</span> and higher, you can use general
expressions with operators such as <code class="ph codeph">&lt;</code>, <code class="ph codeph">IN</code>,
<code class="ph codeph">LIKE</code>, and <code class="ph codeph">BETWEEN</code> in the <code class="ph codeph">PARTITION</code>
clause, instead of only equality operators. For example:
<pre class="pre codeblock"><code>
show files in sample_table partition (j &lt; 5);
show files in sample_table partition (k = 3, l between 1 and 10);
show files in sample_table partition (month like 'J%');
</code></pre>
</div>
<div class="note note"><span class="notetitle">Note:</span>
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 <span class="ph">or Kudu</span>,
because those data management systems do not use the same file-based storage layout.
</div>
<p class="p">
<strong class="ph b">Usage notes:</strong>
</p>
<p class="p">
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 <code class="ph codeph">INSERT</code> 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.
</p>
<p class="p">
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 <code class="ph codeph">.copying</code> or <code class="ph codeph">.tmp</code>.
</p>
<p class="p">
The information for partitioned tables complements the output of the <code class="ph codeph">SHOW PARTITIONS</code>
statement, which summarizes information about each partition. <code class="ph codeph">SHOW PARTITIONS</code>
produces some output for each partition, while <code class="ph codeph">SHOW FILES</code> does not
produce any output for empty partitions because they do not include any data files.
</p>
<p class="p">
<strong class="ph b">HDFS permissions:</strong>
</p>
<p class="p">
The user ID that the <span class="keyword cmdname">impalad</span> daemon runs under,
typically the <code class="ph codeph">impala</code> 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.
</p>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
The following example shows a <code class="ph codeph">SHOW FILES</code> statement
for an unpartitioned table using text format:
</p>
<pre class="pre codeblock"><code>[localhost:21000] &gt; create table unpart_text (x bigint, s string);
[localhost:21000] &gt; insert into unpart_text (x, s) select id, name
&gt; from oreilly.sample_data limit 20e6;
[localhost:21000] &gt; show files in unpart_text;
+--------------------------------------------------------------------------------------+----------+-----------+-----------+
| Path | Size | Partition | EC Policy |
+--------------------------------------------------------------------------------------+----------+-----------+-----------+
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_text/35665776ef85cfaf_1012432410_data.0. | 448.31MB | | NONE |
+--------------------------------------------------------------------------------------+----------+-----------+-----------+
[localhost:21000] &gt; insert into unpart_text (x, s) select id, name from oreilly.sample_data limit 100e6;
[localhost:21000] &gt; show files in unpart_text;
+--------------------------------------------------------------------------------------+----------+-----------+-----------+
| Path | Size | Partition | EC Policy
+--------------------------------------------------------------------------------------+----------+-----------+-----------+
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_text/35665776ef85cfaf_1012432410_data.0. | 448.31MB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_text/ac3dba252a8952b8_1663177415_data.0. | 2.19GB | | NONE |
+--------------------------------------------------------------------------------------+----------+-----------+-----------+
</code></pre>
<p class="p">
This example illustrates how, after issuing some <code class="ph codeph">INSERT ... VALUES</code> 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 <code class="ph codeph">INSERT ... SELECT</code> into a different table, possibly converting the data to Parquet in the process:
</p>
<pre class="pre codeblock"><code>[localhost:21000] &gt; insert into unpart_text values (10,'hello'), (20, 'world');
[localhost:21000] &gt; insert into unpart_text values (-1,'foo'), (-1000, 'bar');
[localhost:21000] &gt; show files in unpart_text;
+--------------------------------------------------------------------------------------+----------+-----------+-----------+
| Path | Size | Partition | EC Policy |
+--------------------------------------------------------------------------------------+----------+-----------+-----------+
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_text/4f11b8bdf8b6aa92_238145083_data.0. | 18B | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_text/35665776ef85cfaf_1012432410_data.0. | 448.31MB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_text/ac3dba252a8952b8_1663177415_data.0. | 2.19GB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_text/cfb8252452445682_1868457216_data.0. | 17B | | NONE |
+--------------------------------------------------------------------------------------+----------+-----------+-----------+
[localhost:21000] &gt; create table unpart_parq stored as parquet as select * from unpart_text;
+---------------------------+
| summary |
+---------------------------+
| Inserted 120000002 row(s) |
+---------------------------+
[localhost:21000] &gt; show files in unpart_parq;
+------------------------------------------------------------------------------------------+----------+-----------+-----------+
| Path | Size | Partition | EC Policy |
+------------------------------------------------------------------------------------------+----------+-----------+-----------+
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_parq/60798d96ba630184_549959007_data.0.parq | 255.36MB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_parq/60798d96ba630184_549959007_data.1.parq | 178.52MB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_parq/60798d96ba630185_549959007_data.0.parq | 255.37MB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_parq/60798d96ba630185_549959007_data.1.parq | 57.71MB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_parq/60798d96ba630186_2141167244_data.0.parq | 255.40MB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_parq/60798d96ba630186_2141167244_data.1.parq | 175.52MB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_parq/60798d96ba630187_1006832086_data.0.parq | 255.40MB | | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/unpart_parq/60798d96ba630187_1006832086_data.1.parq | 214.61MB | | NONE |
+------------------------------------------------------------------------------------------+----------+-----------+-----------+
</code></pre>
<p class="p">
The following example shows a <code class="ph codeph">SHOW FILES</code> 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 <code class="ph codeph">SHOW FILES</code> output.
</p>
<pre class="pre codeblock"><code>[localhost:21000] &gt; create table part_text (x bigint, y int, s string)
&gt; partitioned by (year bigint, month bigint, day bigint);
[localhost:21000] &gt; insert overwrite part_text (x, y, s) partition (year=2014,month=1,day=1)
&gt; select id, val, name from oreilly.normalized_parquet
where id between 1 and 1000000;
[localhost:21000] &gt; insert overwrite part_text (x, y, s) partition (year=2014,month=1,day=2)
&gt; select id, val, name from oreilly.normalized_parquet
&gt; where id between 1000001 and 2000000;
[localhost:21000] &gt; alter table part_text add partition (year=2014,month=1,day=3);
[localhost:21000] &gt; alter table part_text add partition (year=2014,month=1,day=4);
[localhost:21000] &gt; show partitions part_text;
+-------+-------+-----+-------+--------+---------+--------------+-------------------+--------+-------------------+------------------------------------------------------------------------+-----------+
| year | month | day | #Rows | #Files | Size | Bytes Cached | Cache Replication | Format | Incremental stats | Location | EC Policy |
+-------+-------+-----+-------+--------+---------+--------------+-------------------+--------+-------------------+------------------------------------------------------------------------+-----------+
| 2014 | 1 | 1 | -1 | 4 | 25.16MB | NOT CACHED | NOT CACHED | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=1 | NONE |
| 2014 | 1 | 2 | -1 | 4 | 26.22MB | NOT CACHED | NOT CACHED | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=2 | NONE |
| 2014 | 1 | 3 | -1 | 0 | 0B | NOT CACHED | NOT CACHED | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=3 | NONE |
| 2014 | 1 | 4 | -1 | 0 | 0B | NOT CACHED | NOT CACHED | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=4 | NONE |
| Total | | | -1 | 8 | 51.38MB | 0B | | | | | |
+-------+-------+-----+-------+--------+---------+--------------+-------------------+--------+-------------------+------------------------------------------------------------------------+-----------+
[localhost:21000] &gt; show files in part_text;
+------------------------------------------------------------------------------------------------------------+--------+-------------------------+-----------+
| Path | Size | Partition | EC Policy |
+------------------------------------------------------------------------------------------------------------+--------+-------------------------+-----------+
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=1/80732d9dc80689f_1418645991_data.0. | 5.77MB | year=2014/month=1/day=1 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=1/80732d9dc8068a0_1418645991_data.0. | 6.25MB | year=2014/month=1/day=1 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=1/80732d9dc8068a1_147082319_data.0. | 7.16MB | year=2014/month=1/day=1 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=1/80732d9dc8068a2_2111411753_data.0. | 5.98MB | year=2014/month=1/day=1 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=2/21a828cf494b5bbb_501271652_data.0. | 6.42MB | year=2014/month=1/day=2 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=2/21a828cf494b5bbc_501271652_data.0. | 6.62MB | year=2014/month=1/day=2 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=2/21a828cf494b5bbd_1393490200_data.0. | 6.98MB | year=2014/month=1/day=2 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_text/year=2014/month=1/day=2/21a828cf494b5bbe_1393490200_data.0. | 6.20MB | year=2014/month=1/day=2 | NONE |
+------------------------------------------------------------------------------------------------------------+--------+-------------------------+-----------+
</code></pre>
<p class="p">
The following example shows a <code class="ph codeph">SHOW FILES</code> 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 <code class="ph codeph">INSERT</code> 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.)
</p>
<pre class="pre codeblock"><code>[localhost:21000] &gt; create table part_parq (x bigint, y int, s string) partitioned by (year bigint, month bigint, day bigint) stored as parquet;
[localhost:21000] &gt; insert into part_parq partition (year,month,day) select x, y, s, year, month, day from partitioned_text;
[localhost:21000] &gt; show partitions part_parq;
+-------+-------+-----+-------+--------+---------+--------------+-------------------+---------+-------------------+------------------------------------------------------------------------+-----------+
| year | month | day | #Rows | #Files | Size | Bytes Cached | Cache Replication | Format | Incremental stats | Location | EC Policy |
+-------+-------+-----+-------+--------+---------+--------------+-------------------+---------+-------------------+------------------------------------------------------------------------+-----------+
| 2014 | 1 | 1 | -1 | 3 | 17.89MB | NOT CACHED | NOT CACHED | PARQUET | false | hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_parq/year=2014/month=1/day=1 | NONE |
| 2014 | 1 | 2 | -1 | 3 | 17.89MB | NOT CACHED | NOT CACHED | PARQUET | false | hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_parq/year=2014/month=1/day=2 | NONE |
| Total | | | -1 | 6 | 35.79MB | 0B | | | | | |
+-------+-------+-----+-------+--------+---------+--------------+-------------------+---------+-------------------+------------------------------------------------------------------------+-----------+
[localhost:21000] &gt; show files in part_parq;
+-----------------------------------------------------------------------------------------------+--------+-------------------------+-----------+
| Path | Size | Partition | EC Policy |
+-----------------------------------------------------------------------------------------------+--------+-------------------------+-----------+
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_parq/year=2014/month=1/day=1/1134113650_data.0.parq | 4.49MB | year=2014/month=1/day=1 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_parq/year=2014/month=1/day=1/617567880_data.0.parq | 5.14MB | year=2014/month=1/day=1 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_parq/year=2014/month=1/day=1/2099499416_data.0.parq | 8.27MB | year=2014/month=1/day=1 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_parq/year=2014/month=1/day=2/945567189_data.0.parq | 8.80MB | year=2014/month=1/day=2 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_parq/year=2014/month=1/day=2/2145850112_data.0.parq | 4.80MB | year=2014/month=1/day=2 | NONE |
| hdfs://<var class="keyword varname">impala_data_dir</var>/show_files.db/part_parq/year=2014/month=1/day=2/665613448_data.0.parq | 4.29MB | year=2014/month=1/day=2 | NONE |
+-----------------------------------------------------------------------------------------------+--------+-------------------------+-----------+
</code></pre>
<p class="p">
The following example shows output from the <code class="ph codeph">SHOW FILES</code> statement
for a table where the data files are stored in Amazon S3:
</p>
<pre class="pre codeblock"><code>[localhost:21000] &gt; show files in s3_testing.sample_data_s3;
+-----------------------------------------------------------------------+---------+
| Path | Size |
+-----------------------------------------------------------------------+---------+
| s3a://impala-demo/sample_data/e065453cba1988a6_1733868553_data.0.parq | 24.84MB |
+-----------------------------------------------------------------------+---------+
</code></pre>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title3" id="show_roles">
<h2 class="title topictitle2" id="ariaid-title3">SHOW ROLES Statement</h2>
<div class="body conbody">
<p class="p">
The <code class="ph codeph">SHOW ROLES</code> statement displays roles. This syntax
is available in <span class="keyword">Impala 2.0</span> and later only, when
you are using the Ranger authorization framework along with the Ranger
service, as described in <a class="xref" href="impala_authorization.html#sentry_service">Managing Privileges</a>.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
Depending on the roles set up within your organization by the <code class="ph codeph">CREATE ROLE</code> statement, the
output might look something like this:
</p>
<pre class="pre codeblock"><code>show roles;
+-----------+
| role_name |
+-----------+
| analyst |
| role1 |
| sales |
| superuser |
| test_role |
+-----------+
</code></pre>
<p class="p">
<strong class="ph b">HDFS permissions:</strong> This statement does not touch any HDFS files or directories,
therefore no HDFS permissions are required.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_authorization.html#authorization">Impala Authorization</a>
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title4" id="show_current_role">
<h2 class="title topictitle2" id="ariaid-title4">SHOW CURRENT ROLES</h2>
<div class="body conbody">
<p class="p">
The <code class="ph codeph">SHOW CURRENT ROLES</code> statement displays
roles assigned to the current user. This syntax is available in <span class="keyword">Impala 2.0</span> and later only, when you are using the Ranger
authorization framework along with the Ranger service, as described in
<a class="xref" href="impala_authorization.html#sentry_service">Managing Privileges</a>.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
Depending on the roles set up within your organization by the <code class="ph codeph">CREATE ROLE</code> statement, the
output might look something like this:
</p>
<pre class="pre codeblock"><code>show current roles;
+-----------+
| role_name |
+-----------+
| role1 |
| superuser |
+-----------+
</code></pre>
<p class="p">
<strong class="ph b">HDFS permissions:</strong> This statement does not touch any HDFS files or directories,
therefore no HDFS permissions are required.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_authorization.html#authorization">Impala Authorization</a>
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title5" id="show_role_grant">
<h2 class="title topictitle2" id="ariaid-title5">SHOW ROLE GRANT GROUP Statement</h2>
<div class="body conbody">
<p class="p">
The <code class="ph codeph">SHOW ROLE GRANT GROUP</code> 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 <span class="keyword">Impala 2.0</span> and later only, when you are using the Ranger
authorization framework along with the Ranger service, as described in
<a class="xref" href="impala_authorization.html#sentry_service">Managing Privileges</a>.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">HDFS permissions:</strong> This statement does not touch any HDFS files or directories,
therefore no HDFS permissions are required.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_authorization.html#authorization">Impala Authorization</a>
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title6" id="show_grant_role">
<h2 class="title topictitle2" id="ariaid-title6">SHOW GRANT ROLE Statement</h2>
<div class="body conbody">
<p class="p">
The <code class="ph codeph">SHOW GRANT ROLE</code> 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 <span class="keyword">Impala 2.0</span> and later only, when you are using the Ranger
authorization framework along with the Ranger service, as described in
<a class="xref" href="impala_authorization.html#sentry_service">Managing Privileges</a>.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">HDFS permissions:</strong> This statement does not touch any HDFS files or directories,
therefore no HDFS permissions are required.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_authorization.html#authorization">Impala Authorization</a>
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title7" id="show_grant_user">
<h2 class="title topictitle2" id="ariaid-title7">SHOW GRANT USER Statement</h2>
<div class="body conbody">
<p class="p">
The <code class="ph codeph">SHOW GRANT USER</code> 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 <code class="ph codeph">SHOW
GRANT USER</code> for themselves.
</p>
<p class="p">
This syntax is available in <span class="keyword">Impala 3.1</span> and later
only, when you are using the Ranger authorization framework along with
the Ranger service, as described in <a class="xref" href="impala_authorization.html#sentry_service">Managing Privileges</a>.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">HDFS permissions:</strong> This statement does not touch any HDFS files or directories,
therefore no HDFS permissions are required.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_authorization.html#authorization">Impala Authorization</a>
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title8" id="show_databases">
<h2 class="title topictitle2" id="ariaid-title8">SHOW DATABASES</h2>
<div class="body conbody">
<p class="p">
The <code class="ph codeph">SHOW DATABASES</code> statement is often the first one you issue when connecting to an
instance for the first time. You typically issue <code class="ph codeph">SHOW DATABASES</code> to see the names you can
specify in a <code class="ph codeph">USE <var class="keyword varname">db_name</var></code> statement, then after switching to a database
you issue <code class="ph codeph">SHOW TABLES</code> to see the names you can specify in <code class="ph codeph">SELECT</code> and
<code class="ph codeph">INSERT</code> statements.
</p>
<p class="p">
In <span class="keyword">Impala 2.5</span> and higher, the output includes a second column showing any associated comment
for each database.
</p>
<p class="p">
The output of <code class="ph codeph">SHOW DATABASES</code> includes the special <code class="ph codeph">_impala_builtins</code>
database, which lets you view definitions of built-in functions, as described under <code class="ph codeph">SHOW
FUNCTIONS</code>.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
This example shows how you might locate a particular table on an unfamiliar system. The
<code class="ph codeph">DEFAULT</code> database is the one you initially connect to; a database with that name is present
on every system. You can issue <code class="ph codeph">SHOW TABLES IN <var class="keyword varname">db_name</var></code> without going
into a database, or <code class="ph codeph">SHOW TABLES</code> once you are inside a particular database.
</p>
<pre class="pre codeblock"><code>[localhost:21000] &gt; show databases;
+------------------+----------------------------------------------+
| name | comment |
+------------------+----------------------------------------------+
| _impala_builtins | System database for Impala builtin functions |
| default | Default Hive database |
| file_formats | |
+------------------+----------------------------------------------+
Returned 3 row(s) in 0.02s
[localhost:21000] &gt; show tables in file_formats;
+--------------------+
| name |
+--------------------+
| parquet_table |
| rcfile_table |
| sequencefile_table |
| textfile_table |
+--------------------+
Returned 4 row(s) in 0.01s
[localhost:21000] &gt; use file_formats;
[localhost:21000] &gt; show tables like '*parq*';
+--------------------+
| name |
+--------------------+
| parquet_table |
+--------------------+
Returned 1 row(s) in 0.01s</code></pre>
<p class="p">
<strong class="ph b">HDFS permissions:</strong> This statement does not touch any HDFS files or directories,
therefore no HDFS permissions are required.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_databases.html#databases">Overview of Impala Databases</a>, <a class="xref" href="impala_create_database.html#create_database">CREATE DATABASE Statement</a>,
<a class="xref" href="impala_drop_database.html#drop_database">DROP DATABASE Statement</a>, <a class="xref" href="impala_use.html#use">USE Statement</a>
<a class="xref" href="impala_show.html#show_tables">SHOW TABLES Statement</a>,
<a class="xref" href="impala_show.html#show_functions">SHOW FUNCTIONS Statement</a>
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title9" id="show_tables">
<h2 class="title topictitle2" id="ariaid-title9">SHOW TABLES Statement</h2>
<div class="body conbody">
<p class="p">
Displays the names of tables. By default, lists tables in the current database, or with the
<code class="ph codeph">IN</code> clause, in a specified database. By default, lists all tables, or with the
<code class="ph codeph">LIKE</code> clause, only those whose name match a pattern with <code class="ph codeph">*</code> wildcards.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
The user ID that the <span class="keyword cmdname">impalad</span> daemon runs under,
typically the <code class="ph codeph">impala</code> 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 <code class="ph codeph">LOCATION</code> attribute.)
</p>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
The following examples demonstrate the <code class="ph codeph">SHOW TABLES</code> statement.
If the database contains no tables, the result set is empty.
If the database does contain tables, <code class="ph codeph">SHOW TABLES IN <var class="keyword varname">db_name</var></code>
lists all the table names. <code class="ph codeph">SHOW TABLES</code> with no qualifiers lists
all the table names in the current database.
</p>
<pre class="pre codeblock"><code>create database empty_db;
show tables in empty_db;
Fetched 0 row(s) in 0.11s
create database full_db;
create table full_db.t1 (x int);
create table full_db.t2 like full_db.t1;
show tables in full_db;
+------+
| name |
+------+
| t1 |
| t2 |
+------+
use full_db;
show tables;
+------+
| name |
+------+
| t1 |
| t2 |
+------+
</code></pre>
<p class="p">
This example demonstrates how <code class="ph codeph">SHOW TABLES LIKE '<var class="keyword varname">wildcard_pattern</var>'</code>
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.
</p>
<pre class="pre codeblock"><code>create table fact_tbl (x int);
create table dim_tbl_1 (s string);
create table dim_tbl_2 (s string);
/* Asterisk is the wildcard character. Only 2 out of the 3 just-created tables are returned. */
show tables like 'dim*';
+-----------+
| name |
+-----------+
| dim_tbl_1 |
| dim_tbl_2 |
+-----------+
/* We are already in the FULL_DB database, but just to be sure we can specify the database name also. */
show tables in full_db like 'dim*';
+-----------+
| name |
+-----------+
| dim_tbl_1 |
| dim_tbl_2 |
+-----------+
/* The pipe character separates multiple wildcard patterns. */
show tables like '*dim*|t*';
+-----------+
| name |
+-----------+
| dim_tbl_1 |
| dim_tbl_2 |
| t1 |
| t2 |
+-----------+
</code></pre>
<p class="p">
<strong class="ph b">HDFS permissions:</strong> This statement does not touch any HDFS files or directories,
therefore no HDFS permissions are required.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_tables.html#tables">Overview of Impala Tables</a>, <a class="xref" href="impala_create_table.html#create_table">CREATE TABLE Statement</a>,
<a class="xref" href="impala_alter_table.html#alter_table">ALTER TABLE Statement</a>, <a class="xref" href="impala_drop_table.html#drop_table">DROP TABLE Statement</a>,
<a class="xref" href="impala_describe.html#describe">DESCRIBE Statement</a>, <a class="xref" href="impala_show.html#show_create_table">SHOW CREATE TABLE Statement</a>,
<a class="xref" href="impala_show.html#show_table_stats">SHOW TABLE STATS Statement</a>,
<a class="xref" href="impala_show.html#show_databases">SHOW DATABASES</a>,
<a class="xref" href="impala_show.html#show_functions">SHOW FUNCTIONS Statement</a>
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title10" id="show_create_table">
<h2 class="title topictitle2" id="ariaid-title10">SHOW CREATE TABLE Statement</h2>
<div class="body conbody">
<p class="p">
As a schema changes over time, you might run a <code class="ph codeph">CREATE TABLE</code> statement followed by several
<code class="ph codeph">ALTER TABLE</code> statements. To capture the cumulative effect of all those statements,
<code class="ph codeph">SHOW CREATE TABLE</code> displays a <code class="ph codeph">CREATE TABLE</code> 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 <code class="ph codeph">CREATE TABLE</code> and
<code class="ph codeph">ALTER TABLE</code> statements. When creating variations on the original table, or cloning the
original table on a different system, you might need to edit the <code class="ph codeph">SHOW CREATE TABLE</code> output
to change things such as the database name, <code class="ph codeph">LOCATION</code> field, and so on that might be
different on the destination system.
</p>
<p class="p">
If you specify a view name in the <code class="ph codeph">SHOW CREATE TABLE</code>,
it returns a <code class="ph codeph">CREATE VIEW</code> statement with column names
and the original SQL statement to reproduce the view. You need the
<code class="ph codeph">VIEW_METADATA</code> privilege on the view and
<code class="ph codeph">SELECT</code> privilege on all underlying views and tables to
successfully run the <code class="ph codeph">SHOW CREATE VIEW</code> statement for a
view. The <code class="ph codeph">SHOW CREATE VIEW</code> is available as an alias for
<code class="ph codeph">SHOW CREATE TABLE</code>.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">HDFS permissions:</strong> This statement does not touch any HDFS files or directories,
therefore no HDFS permissions are required.
</p>
<p class="p">
For Kudu tables:
</p>
<ul class="ul">
<li class="li">
<p class="p">
The column specifications include attributes such as <code class="ph codeph">NULL</code>,
<code class="ph codeph">NOT NULL</code>, <code class="ph codeph">ENCODING</code>, and <code class="ph codeph">COMPRESSION</code>.
If you do not specify those attributes in the original <code class="ph codeph">CREATE TABLE</code> statement,
the <code class="ph codeph">SHOW CREATE TABLE</code> output displays the defaults that were used.
</p>
</li>
<li class="li">
<p class="p">
The specifications of any <code class="ph codeph">RANGE</code> clauses are not displayed in full.
To see the definition of the range clauses for a Kudu table, use the <code class="ph codeph">SHOW RANGE PARTITIONS</code> statement.
</p>
</li>
<li class="li">
<p class="p">
The <code class="ph codeph">TBLPROPERTIES</code> output reflects the Kudu master address
and the internal Kudu name associated with the Impala table.
</p>
</li>
</ul>
<pre class="pre codeblock"><code>
show CREATE TABLE numeric_grades_default_letter;
+------------------------------------------------------------------------------------------------+
| result |
+------------------------------------------------------------------------------------------------+
| CREATE TABLE user.numeric_grades_default_letter ( |
| score TINYINT NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION, |
| letter_grade STRING NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION DEFAULT '-', |
| student STRING NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION, |
| PRIMARY KEY (score) |
| ) |
| PARTITION BY RANGE (score) (...) . |
| STORED AS KUDU |
| TBLPROPERTIES ('kudu.master_addresses'='vd0342.example.com:7051') |
+------------------------------------------------------------------------------------------------+
show range partitions numeric_grades_default_letter;
+--------------------------+
| RANGE (score) |
+--------------------------+
| 0 &lt;= VALUES &lt; 50 |
| 50 &lt;= VALUES &lt; 65 |
| 65 &lt;= VALUES &lt; 80 |
| 80 &lt;= VALUES &lt; 100 |
+--------------------------+
</code></pre>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
The following example shows how various clauses from the <code class="ph codeph">CREATE TABLE</code> statement are
represented in the output of <code class="ph codeph">SHOW CREATE TABLE</code>.
</p>
<pre class="pre codeblock"><code>create table show_create_table_demo (id int comment "Unique ID", y double, s string)
partitioned by (year smallint)
stored as parquet;
show create table show_create_table_demo;
+----------------------------------------------------------------------------------------+
| result |
+----------------------------------------------------------------------------------------+
| CREATE TABLE scratch.show_create_table_demo ( |
| id INT COMMENT 'Unique ID', |
| y DOUBLE, |
| s STRING |
| ) |
| PARTITIONED BY ( |
| year SMALLINT |
| ) |
| STORED AS PARQUET |
| LOCATION 'hdfs://127.0.0.1:8020/user/hive/warehouse/scratch.db/show_create_table_demo' |
| TBLPROPERTIES ('transient_lastDdlTime'='1418152582') |
+----------------------------------------------------------------------------------------+
</code></pre>
<p class="p">
The following example shows how, after a sequence of <code class="ph codeph">ALTER TABLE</code> statements, the output
from <code class="ph codeph">SHOW CREATE TABLE</code> represents the current state of the table. This output could be
used to create a matching table rather than executing the original <code class="ph codeph">CREATE TABLE</code> and
sequence of <code class="ph codeph">ALTER TABLE</code> statements.
</p>
<pre class="pre codeblock"><code>alter table show_create_table_demo drop column s;
alter table show_create_table_demo set fileformat textfile;
show create table show_create_table_demo;
+----------------------------------------------------------------------------------------+
| result |
+----------------------------------------------------------------------------------------+
| CREATE TABLE scratch.show_create_table_demo ( |
| id INT COMMENT 'Unique ID', |
| y DOUBLE |
| ) |
| PARTITIONED BY ( |
| year SMALLINT |
| ) |
| STORED AS TEXTFILE |
| LOCATION 'hdfs://127.0.0.1:8020/user/hive/warehouse/demo.db/show_create_table_demo' |
| TBLPROPERTIES ('transient_lastDdlTime'='1418152638') |
+----------------------------------------------------------------------------------------+
</code></pre>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_create_table.html#create_table">CREATE TABLE Statement</a>, <a class="xref" href="impala_describe.html#describe">DESCRIBE Statement</a>,
<a class="xref" href="impala_show.html#show_tables">SHOW TABLES Statement</a>
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title11" id="show_create_view">
<h2 class="title topictitle2" id="ariaid-title11">SHOW CREATE VIEW Statement</h2>
<div class="body conbody">
<p class="p"> The <code class="ph codeph">SHOW CREATE VIEW</code>, it returns a <code class="ph codeph">CREATE
VIEW</code> statement with column names and the original SQL
statement to reproduce the view. You need the
<code class="ph codeph">VIEW_METADATA</code> privilege on the view and
<code class="ph codeph">SELECT</code> privilege on all underlying views and tables to
successfully run the <code class="ph codeph">SHOW CREATE VIEW</code> statement for a
view. </p>
<p class="p">
The <code class="ph codeph">SHOW CREATE VIEW</code> is an alias for <code class="ph codeph">SHOW
CREATE TABLE</code>.
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title12" id="show_table_stats">
<h2 class="title topictitle2" id="ariaid-title12">SHOW TABLE STATS Statement</h2>
<div class="body conbody">
<p class="p">
The <code class="ph codeph">SHOW TABLE STATS</code> and <code class="ph codeph">SHOW COLUMN STATS</code> variants are important for
tuning performance and diagnosing performance issues, especially with the largest tables and the most
complex join queries.
</p>
<p class="p">
Any values that are not available (because the <code class="ph codeph">COMPUTE STATS</code> statement has not been run
yet) are displayed as <code class="ph codeph">-1</code>.
</p>
<p class="p">
<code class="ph codeph">SHOW TABLE STATS</code> 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 <code class="ph codeph">COMPUTE STATS</code> statement. A
<code class="ph codeph">-1</code> in the <code class="ph codeph">#Rows</code> output column indicates that the <code class="ph codeph">COMPUTE
STATS</code> statement has never been run for this table. If the table is partitioned, <code class="ph codeph">SHOW TABLE
STATS</code> provides this information for each partition. (It produces the same output as the
<code class="ph codeph">SHOW PARTITIONS</code> statement in this case.)
</p>
<p class="p">
The output of <code class="ph codeph">SHOW COLUMN STATS</code> is primarily only useful after the <code class="ph codeph">COMPUTE
STATS</code> statement has been run on the table. A <code class="ph codeph">-1</code> in the <code class="ph codeph">#Distinct
Values</code> output column indicates that the <code class="ph codeph">COMPUTE STATS</code> statement has never been
run for this table. Currently, Impala always leaves the <code class="ph codeph">#Nulls</code> column as
<code class="ph codeph">-1</code>, even after <code class="ph codeph">COMPUTE STATS</code> has been run.
</p>
<p class="p">
These <code class="ph codeph">SHOW</code> statements work on actual tables only, not on views.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">Kudu considerations:</strong>
</p>
<p class="p">
Because Kudu tables do not have characteristics derived from HDFS, such
as number of files and HDFS cache status, the output of
<code class="ph codeph">SHOW TABLE STATS</code> reflects different characteristics
that apply to Kudu tables.
</p>
<pre class="pre codeblock"><code>
show table stats kudu_table;
+-------+-------------+---------+--------+------------------------------+
| #Rows | #Partitions | Size | Format | Location |
+-------+-------------+---------+--------+------------------------------+
| 100 | 7 | 56.16MB | KUDU | kudu-master.example.com:7051 |
+-------+-------------+---------+--------+------------------------------+
</code></pre>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
The following examples show how the <code class="ph codeph">SHOW TABLE STATS</code> statement displays physical
information about a table and the associated data files:
</p>
<pre class="pre codeblock"><code>show table stats store_sales;
+-------+--------+----------+--------------+--------+-------------------+------------------------------------+-----------+
| #Rows | #Files | Size | Bytes Cached | Format | Incremental stats | Location | EC Policy |
+-------+--------+----------+--------------+--------+-------------------+------------------------------------+-----------+
| -1 | 1 | 370.45MB | NOT CACHED | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/store_sales | NONE |
+-------+--------+----------+--------------+--------+-------------------+------------------------------------+-----------+
show table stats customer;
+-------+--------+---------+--------------+--------+-------------------+---------------------------------+-----------+
| #Rows | #Files | Size | Bytes Cached | Format | Incremental stats | Location | EC Policy |
+-------+--------+---------+--------------+--------+-------------------+---------------------------------+-----------+
| -1 | 1 | 12.60MB | NOT CACHED | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/customer | NONE |
+-------+--------+---------+--------------+--------+-------------------+---------------------------------+-----------+
</code></pre>
<p class="p">
The following example shows how, after a <code class="ph codeph">COMPUTE STATS</code> or <code class="ph codeph">COMPUTE INCREMENTAL
STATS</code> statement, the <code class="ph codeph">#Rows</code> field is now filled in. Because the
<code class="ph codeph">STORE_SALES</code> table in this example is not partitioned, the <code class="ph codeph">COMPUTE INCREMENTAL
STATS</code> statement produces regular stats rather than incremental stats, therefore the
<code class="ph codeph">Incremental stats</code> field remains <code class="ph codeph">false</code>.
</p>
<pre class="pre codeblock"><code>compute stats customer;
+------------------------------------------+
| summary |
+------------------------------------------+
| Updated 1 partition(s) and 18 column(s). |
+------------------------------------------+
show table stats customer;
+--------+--------+---------+--------------+--------+-------------------+---------------------------------+-----------+
| #Rows | #Files | Size | Bytes Cached | Format | Incremental stats | Location | EC Policy |
+--------+--------+---------+--------------+--------+-------------------+---------------------------------+-----------+
| 100000 | 1 | 12.60MB | NOT CACHED | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/customer | NONE |
+--------+--------+---------+--------------+--------+-------------------+---------------------------------+-----------+
compute incremental stats store_sales;
+------------------------------------------+
| summary |
+------------------------------------------+
| Updated 1 partition(s) and 23 column(s). |
+------------------------------------------+
show table stats store_sales;
+---------+--------+----------+--------------+--------+-------------------+------------------------------------+-----------+
| #Rows | #Files | Size | Bytes Cached | Format | Incremental stats | Location | EC Policy |
+---------+--------+----------+--------------+--------+-------------------+------------------------------------+-----------+
| 2880404 | 1 | 370.45MB | NOT CACHED | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/store_sales | NONE |
+---------+--------+----------+--------------+--------+-------------------+------------------------------------+-----------+
</code></pre>
<p class="p">
<strong class="ph b">HDFS permissions:</strong>
</p>
<p class="p">
The user ID that the <span class="keyword cmdname">impalad</span> daemon runs under,
typically the <code class="ph codeph">impala</code> 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 <code class="ph codeph">LOCATION</code> attribute.)
The Impala user must also have execute
permission for the database directory, and any parent directories of the database directory in HDFS.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_compute_stats.html#compute_stats">COMPUTE STATS Statement</a>, <a class="xref" href="impala_show.html#show_column_stats">SHOW COLUMN STATS Statement</a>
</p>
<p class="p">
See <a class="xref" href="impala_perf_stats.html#perf_stats">Table and Column Statistics</a> for usage information and examples.
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title13" id="show_column_stats">
<h2 class="title topictitle2" id="ariaid-title13">SHOW COLUMN STATS Statement</h2>
<div class="body conbody">
<p class="p">
The <code class="ph codeph">SHOW TABLE STATS</code> and <code class="ph codeph">SHOW COLUMN STATS</code> variants are important for
tuning performance and diagnosing performance issues, especially with the largest tables and the most
complex join queries.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
The output for <code class="ph codeph">SHOW COLUMN STATS</code> 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.
</p>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
The following examples show the output of the <code class="ph codeph">SHOW COLUMN STATS</code> statement for some tables,
before the <code class="ph codeph">COMPUTE STATS</code> statement is run. Impala deduces some information, such as
maximum and average size for fixed-length columns, and leaves and unknown values as <code class="ph codeph">-1</code>.
</p>
<pre class="pre codeblock"><code>show column stats customer;
+------------------------+--------+------------------+--------+----------+----------+
| Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size |
+------------------------+--------+------------------+--------+----------+----------+
| c_customer_sk | INT | -1 | -1 | 4 | 4 |
| c_customer_id | STRING | -1 | -1 | -1 | -1 |
| c_current_cdemo_sk | INT | -1 | -1 | 4 | 4 |
| c_current_hdemo_sk | INT | -1 | -1 | 4 | 4 |
| c_current_addr_sk | INT | -1 | -1 | 4 | 4 |
| c_first_shipto_date_sk | INT | -1 | -1 | 4 | 4 |
| c_first_sales_date_sk | INT | -1 | -1 | 4 | 4 |
| c_salutation | STRING | -1 | -1 | -1 | -1 |
| c_first_name | STRING | -1 | -1 | -1 | -1 |
| c_last_name | STRING | -1 | -1 | -1 | -1 |
| c_preferred_cust_flag | STRING | -1 | -1 | -1 | -1 |
| c_birth_day | INT | -1 | -1 | 4 | 4 |
| c_birth_month | INT | -1 | -1 | 4 | 4 |
| c_birth_year | INT | -1 | -1 | 4 | 4 |
| c_birth_country | STRING | -1 | -1 | -1 | -1 |
| c_login | STRING | -1 | -1 | -1 | -1 |
| c_email_address | STRING | -1 | -1 | -1 | -1 |
| c_last_review_date_sk | STRING | -1 | -1 | -1 | -1 |
+------------------------+--------+------------------+--------+----------+----------+
show column stats store_sales;
+-----------------------+-------+------------------+--------+----------+----------+
| Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size |
+-----------------------+-------+------------------+--------+----------+----------+
| ss_sold_date_sk | INT | -1 | -1 | 4 | 4 |
| ss_sold_time_sk | INT | -1 | -1 | 4 | 4 |
| ss_item_sk | INT | -1 | -1 | 4 | 4 |
| ss_customer_sk | INT | -1 | -1 | 4 | 4 |
| ss_cdemo_sk | INT | -1 | -1 | 4 | 4 |
| ss_hdemo_sk | INT | -1 | -1 | 4 | 4 |
| ss_addr_sk | INT | -1 | -1 | 4 | 4 |
| ss_store_sk | INT | -1 | -1 | 4 | 4 |
| ss_promo_sk | INT | -1 | -1 | 4 | 4 |
| ss_ticket_number | INT | -1 | -1 | 4 | 4 |
| ss_quantity | INT | -1 | -1 | 4 | 4 |
| ss_wholesale_cost | FLOAT | -1 | -1 | 4 | 4 |
| ss_list_price | FLOAT | -1 | -1 | 4 | 4 |
| ss_sales_price | FLOAT | -1 | -1 | 4 | 4 |
| ss_ext_discount_amt | FLOAT | -1 | -1 | 4 | 4 |
| ss_ext_sales_price | FLOAT | -1 | -1 | 4 | 4 |
| ss_ext_wholesale_cost | FLOAT | -1 | -1 | 4 | 4 |
| ss_ext_list_price | FLOAT | -1 | -1 | 4 | 4 |
| ss_ext_tax | FLOAT | -1 | -1 | 4 | 4 |
| ss_coupon_amt | FLOAT | -1 | -1 | 4 | 4 |
| ss_net_paid | FLOAT | -1 | -1 | 4 | 4 |
| ss_net_paid_inc_tax | FLOAT | -1 | -1 | 4 | 4 |
| ss_net_profit | FLOAT | -1 | -1 | 4 | 4 |
+-----------------------+-------+------------------+--------+----------+----------+
</code></pre>
<p class="p">
The following examples show the output of the <code class="ph codeph">SHOW COLUMN STATS</code> statement for some tables,
after the <code class="ph codeph">COMPUTE STATS</code> statement is run. Now most of the <code class="ph codeph">-1</code> values are
changed to reflect the actual table data. The <code class="ph codeph">#Nulls</code> column remains <code class="ph codeph">-1</code>
because Impala does not use the number of <code class="ph codeph">NULL</code> values to influence query planning.
</p>
<pre class="pre codeblock"><code>compute stats customer;
+------------------------------------------+
| summary |
+------------------------------------------+
| Updated 1 partition(s) and 18 column(s). |
+------------------------------------------+
compute stats store_sales;
+------------------------------------------+
| summary |
+------------------------------------------+
| Updated 1 partition(s) and 23 column(s). |
+------------------------------------------+
show column stats customer;
+------------------------+--------+------------------+--------+----------+--------+
| Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size
+------------------------+--------+------------------+--------+----------+--------+
| c_customer_sk | INT | 139017 | -1 | 4 | 4 |
| c_customer_id | STRING | 111904 | -1 | 16 | 16 |
| c_current_cdemo_sk | INT | 95837 | -1 | 4 | 4 |
| c_current_hdemo_sk | INT | 8097 | -1 | 4 | 4 |
| c_current_addr_sk | INT | 57334 | -1 | 4 | 4 |
| c_first_shipto_date_sk | INT | 4374 | -1 | 4 | 4 |
| c_first_sales_date_sk | INT | 4409 | -1 | 4 | 4 |
| c_salutation | STRING | 7 | -1 | 4 | 3.1308 |
| c_first_name | STRING | 3887 | -1 | 11 | 5.6356 |
| c_last_name | STRING | 4739 | -1 | 13 | 5.9106 |
| c_preferred_cust_flag | STRING | 3 | -1 | 1 | 0.9656 |
| c_birth_day | INT | 31 | -1 | 4 | 4 |
| c_birth_month | INT | 12 | -1 | 4 | 4 |
| c_birth_year | INT | 71 | -1 | 4 | 4 |
| c_birth_country | STRING | 205 | -1 | 20 | 8.4001 |
| c_login | STRING | 1 | -1 | 0 | 0 |
| c_email_address | STRING | 94492 | -1 | 46 | 26.485 |
| c_last_review_date_sk | STRING | 349 | -1 | 7 | 6.7561 |
+------------------------+--------+------------------+--------+----------+--------+
show column stats store_sales;
+-----------------------+-------+------------------+--------+----------+----------+
| Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size |
+-----------------------+-------+------------------+--------+----------+----------+
| ss_sold_date_sk | INT | 4395 | -1 | 4 | 4 |
| ss_sold_time_sk | INT | 63617 | -1 | 4 | 4 |
| ss_item_sk | INT | 19463 | -1 | 4 | 4 |
| ss_customer_sk | INT | 122720 | -1 | 4 | 4 |
| ss_cdemo_sk | INT | 242982 | -1 | 4 | 4 |
| ss_hdemo_sk | INT | 8097 | -1 | 4 | 4 |
| ss_addr_sk | INT | 70770 | -1 | 4 | 4 |
| ss_store_sk | INT | 6 | -1 | 4 | 4 |
| ss_promo_sk | INT | 355 | -1 | 4 | 4 |
| ss_ticket_number | INT | 304098 | -1 | 4 | 4 |
| ss_quantity | INT | 105 | -1 | 4 | 4 |
| ss_wholesale_cost | FLOAT | 9600 | -1 | 4 | 4 |
| ss_list_price | FLOAT | 22191 | -1 | 4 | 4 |
| ss_sales_price | FLOAT | 20693 | -1 | 4 | 4 |
| ss_ext_discount_amt | FLOAT | 228141 | -1 | 4 | 4 |
| ss_ext_sales_price | FLOAT | 433550 | -1 | 4 | 4 |
| ss_ext_wholesale_cost | FLOAT | 406291 | -1 | 4 | 4 |
| ss_ext_list_price | FLOAT | 574871 | -1 | 4 | 4 |
| ss_ext_tax | FLOAT | 91806 | -1 | 4 | 4 |
| ss_coupon_amt | FLOAT | 228141 | -1 | 4 | 4 |
| ss_net_paid | FLOAT | 493107 | -1 | 4 | 4 |
| ss_net_paid_inc_tax | FLOAT | 653523 | -1 | 4 | 4 |
| ss_net_profit | FLOAT | 611934 | -1 | 4 | 4 |
+-----------------------+-------+------------------+--------+----------+----------+
</code></pre>
<p class="p">
<strong class="ph b">HDFS permissions:</strong>
</p>
<p class="p">
The user ID that the <span class="keyword cmdname">impalad</span> daemon runs under,
typically the <code class="ph codeph">impala</code> 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 <code class="ph codeph">LOCATION</code> attribute.)
The Impala user must also have execute
permission for the database directory, and any parent directories of the database directory in HDFS.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_compute_stats.html#compute_stats">COMPUTE STATS Statement</a>, <a class="xref" href="impala_show.html#show_table_stats">SHOW TABLE STATS Statement</a>
</p>
<p class="p">
See <a class="xref" href="impala_perf_stats.html#perf_stats">Table and Column Statistics</a> for usage information and examples.
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title14" id="show_partitions">
<h2 class="title topictitle2" id="ariaid-title14">SHOW PARTITIONS Statement</h2>
<div class="body conbody">
<p class="p">
<code class="ph codeph">SHOW PARTITIONS</code> displays information about each partition for a partitioned table. (The
output is the same as the <code class="ph codeph">SHOW TABLE STATS</code> statement, but <code class="ph codeph">SHOW PARTITIONS</code>
only works on a partitioned table.) Because it displays table statistics for all partitions, the output is
more informative if you have run the <code class="ph codeph">COMPUTE STATS</code> statement after creating all the
partitions. See <a class="xref" href="impala_compute_stats.html#compute_stats">COMPUTE STATS Statement</a> for details. For example, on a
<code class="ph codeph">CENSUS</code> table partitioned on the <code class="ph codeph">YEAR</code> column:
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">Kudu considerations:</strong>
</p>
<p class="p">
The optional <code class="ph codeph">RANGE</code> clause only applies to Kudu tables. It displays only the partitions
defined by the <code class="ph codeph">RANGE</code> clause of <code class="ph codeph">CREATE TABLE</code> or <code class="ph codeph">ALTER TABLE</code>.
</p>
<p class="p">
Although you can specify <code class="ph codeph">&lt;</code> or
<code class="ph codeph">&lt;=</code> comparison operators when defining
range partitions for Kudu tables, Kudu rewrites them if necessary
to represent each range as
<code class="ph codeph"><var class="keyword varname">low_bound</var> &lt;= VALUES &lt; <var class="keyword varname">high_bound</var></code>.
This rewriting might involve incrementing one of the boundary values
or appending a <code class="ph codeph">\0</code> for string values, so that the
partition covers the same range as originally specified.
</p>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
The following example shows the output for a Parquet, text, or other
HDFS-backed table partitioned on the <code class="ph codeph">YEAR</code> column:
</p>
<pre class="pre codeblock"><code>[localhost:21000] &gt; show partitions census;
+-------+-------+--------+------+---------+-------------------+-----------------------------------------+-----------+
| year | #Rows | #Files | Size | Format | Incremental stats | Location | EC Policy |
+-------+-------+--------+------+---------+-------------------+-----------------------------------------+-----------+
| 2000 | -1 | 0 | 0B | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/census/year=2000 | NONE |
| 2004 | -1 | 0 | 0B | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/census/year=2000 | NONE |
| 2008 | -1 | 0 | 0B | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/census/year=2000 | NONE |
| 2010 | -1 | 0 | 0B | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/census/year=2000 | NONE |
| 2011 | 4 | 1 | 22B | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/census/year=2000 | NONE |
| 2012 | 4 | 1 | 22B | TEXT | false | hdfs://<var class="keyword varname">impala_data_dir</var>/census/year=2000 | NONE |
| 2013 | 1 | 1 | 231B | PARQUET | false | hdfs://<var class="keyword varname">impala_data_dir</var>/census/year=2000 | NONE |
| Total | 9 | 3 | 275B | | | | |
+-------+-------+--------+------+---------+-------------------+-----------------------------------------+-----------+
</code></pre>
<p class="p">
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 <code class="ph codeph">PARTITIONS <var class="keyword varname">N</var></code> clause of
<code class="ph codeph">CREATE TABLE</code>. If the Kudu table is created with the clause
<code class="ph codeph">PARTITIONS 20</code>, then the result set of
<code class="ph codeph">SHOW PARTITIONS</code> consists of 20 rows, each representing one of
the numbered partitions. For example:
</p>
<pre class="pre codeblock"><code>
show partitions million_rows_hash;
+--------+-----------+----------+-----------------------+------------+
| # Rows | Start Key | Stop Key | Leader Replica | # Replicas |
+--------+-----------+----------+-----------------------+------------+
| -1 | | 00000001 | n236.example.com:7050 | 3 |
| -1 | 00000001 | 00000002 | n236.example.com:7050 | 3 |
| -1 | 00000002 | 00000003 | n336.example.com:7050 | 3 |
| -1 | 00000003 | 00000004 | n238.example.com:7050 | 3 |
| -1 | 00000004 | 00000005 | n338.example.com:7050 | 3 |
...
| -1 | 0000002E | 0000002F | n240.example.com:7050 | 3 |
| -1 | 0000002F | 00000030 | n336.example.com:7050 | 3 |
| -1 | 00000030 | 00000031 | n240.example.com:7050 | 3 |
| -1 | 00000031 | | n334.example.com:7050 | 3 |
+--------+-----------+----------+-----------------------+------------+
Fetched 50 row(s) in 0.05s
</code></pre>
<p class="p">
Impala only computes the number of rows for the whole Kudu table, partition level
row counts are not available.
</p>
<p class="p">
The following example shows the output for a Kudu table
using the range partitioning mechanism:
</p>
<pre class="pre codeblock"><code>
show range partitions million_rows_range;
+-----------------------+
| RANGE (id) |
+-----------------------+
| VALUES &lt; "A" |
| "A" &lt;= VALUES &lt; "[" |
| "a" &lt;= VALUES &lt; "{" |
| "{" &lt;= VALUES &lt; "~\0" |
+-----------------------+
</code></pre>
<p class="p">
<strong class="ph b">HDFS permissions:</strong>
</p>
<p class="p">
The user ID that the <span class="keyword cmdname">impalad</span> daemon runs under,
typically the <code class="ph codeph">impala</code> 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 <code class="ph codeph">LOCATION</code> attribute.)
The Impala user must also have execute
permission for the database directory, and any parent directories of the database directory in HDFS.
</p>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
See <a class="xref" href="impala_perf_stats.html#perf_stats">Table and Column Statistics</a> for usage information and examples.
</p>
<p class="p">
<a class="xref" href="impala_show.html#show_table_stats">SHOW TABLE STATS Statement</a>, <a class="xref" href="impala_partitioning.html#partitioning">Partitioning for Impala Tables</a>
</p>
</div>
</div>
<div class="topic concept nested1" aria-labelledby="ariaid-title15" id="show_functions">
<h2 class="title topictitle2" id="ariaid-title15">SHOW FUNCTIONS Statement</h2>
<div class="body conbody">
<p class="p">
By default, <code class="ph codeph">SHOW FUNCTIONS</code> displays user-defined functions (UDFs) and <code class="ph codeph">SHOW
AGGREGATE FUNCTIONS</code> displays user-defined aggregate functions (UDAFs) associated with a particular
database. The output from <code class="ph codeph">SHOW FUNCTIONS</code> includes the argument signature of each function.
You specify this argument signature as part of the <code class="ph codeph">DROP FUNCTION</code> statement. You might have
several UDFs with the same name, each accepting different argument data types.
</p>
<p class="p">
<strong class="ph b">Usage notes:</strong>
</p>
<p class="p">
In <span class="keyword">Impala 2.5</span> and higher, the <code class="ph codeph">SHOW FUNCTIONS</code> output includes
a new column, labelled <code class="ph codeph">is persistent</code>. This property is <code class="ph codeph">true</code> for
Impala built-in functions, C++ UDFs, and Java UDFs created using the new <code class="ph codeph">CREATE FUNCTION</code>
syntax with no signature. It is <code class="ph codeph">false</code> for Java UDFs created using the old
<code class="ph codeph">CREATE FUNCTION</code> syntax that includes the types for the arguments and return value.
Any functions with <code class="ph codeph">false</code> shown for this property must be created again by the
<code class="ph codeph">CREATE FUNCTION</code> statement each time the Impala catalog server is restarted.
See <code class="ph codeph">CREATE FUNCTION</code> 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.
</p>
<p class="p">
<strong class="ph b">Security considerations:</strong>
</p>
<p class="p">
When authorization is enabled, the output of the <code class="ph codeph">SHOW</code> 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 <code class="ph codeph">SHOW</code> output, check with the system
administrator if you need to be granted a new privilege for that object. See
<a class="xref" href="../shared/../topics/impala_authorization.html#authorization">Impala Authorization</a> for how to set up
authorization and add privileges for specific objects.
</p>
<p class="p">
<strong class="ph b">HDFS permissions:</strong> This statement does not touch any HDFS files or directories,
therefore no HDFS permissions are required.
</p>
<p class="p">
<strong class="ph b">Examples:</strong>
</p>
<p class="p">
To display Impala built-in functions, specify the special database name <code class="ph codeph">_impala_builtins</code>:
</p>
<pre class="pre codeblock"><code>show functions in _impala_builtins;
+--------------+-------------------------------------------------+-------------+---------------+
| return type | signature | binary type | is persistent |
+--------------+-------------------------------------------------+-------------+---------------+
| BIGINT | abs(BIGINT) | BUILTIN | true |
| DECIMAL(*,*) | abs(DECIMAL(*,*)) | BUILTIN | true |
| DOUBLE | abs(DOUBLE) | BUILTIN | true |
| FLOAT | abs(FLOAT) | BUILTIN | true |
+----------------+-----------------------------------------------+-------------+---------------+
show functions in _impala_builtins like '*week*';
+-------------+------------------------------+-------------+---------------+
| return type | signature | binary type | is persistent |
+-------------+------------------------------+-------------+---------------+
| INT | dayofweek(TIMESTAMP) | BUILTIN | true |
| INT | weekofyear(TIMESTAMP) | BUILTIN | true |
| TIMESTAMP | weeks_add(TIMESTAMP, BIGINT) | BUILTIN | true |
| TIMESTAMP | weeks_add(TIMESTAMP, INT) | BUILTIN | true |
| TIMESTAMP | weeks_sub(TIMESTAMP, BIGINT) | BUILTIN | true |
| TIMESTAMP | weeks_sub(TIMESTAMP, INT) | BUILTIN | true |
+-------------+------------------------------+-------------+---------------+
</code></pre>
<p class="p">
<strong class="ph b">Related information:</strong>
</p>
<p class="p">
<a class="xref" href="impala_functions_overview.html#functions">Overview of Impala Functions</a>, <a class="xref" href="impala_functions.html#builtins">Impala Built-In Functions</a>,
<a class="xref" href="impala_udf.html#udfs">User-Defined Functions (UDFs)</a>,
<a class="xref" href="impala_show.html#show_databases">SHOW DATABASES</a>,
<a class="xref" href="impala_show.html#show_tables">SHOW TABLES Statement</a>
</p>
</div>
</div>
</body>
</html>