From 8d16dc1e7f148243a5d2544f4eeec4ccf9498fcb Mon Sep 17 00:00:00 2001 From: shivusondur Date: Fri, 30 Aug 2019 17:35:41 +0530 Subject: [PATCH 1/4] added doc for "show table extended" sql command. --- docs/sql-ref-syntax-aux-show-table.md | 148 +++++++++++++++++++++++++- 1 file changed, 145 insertions(+), 3 deletions(-) diff --git a/docs/sql-ref-syntax-aux-show-table.md b/docs/sql-ref-syntax-aux-show-table.md index ad549b6b11ec..6d59735da418 100644 --- a/docs/sql-ref-syntax-aux-show-table.md +++ b/docs/sql-ref-syntax-aux-show-table.md @@ -1,7 +1,7 @@ --- layout: global -title: SHOW TABLE -displayTitle: SHOW TABLE +title: SHOW TABLE EXTENDED +displayTitle: SHOW TABLE EXTENDED license: | Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -18,5 +18,147 @@ license: | See the License for the specific language governing permissions and limitations under the License. --- +### Description -**This page is under construction** +SHOW TABLE EXTENDED will show information for all tables matching the given regular expression. +Output includes basic table information and file system information like `Last Access`, +`Created By`, `Type`, `Provider`, `Table Properties`, `Location`, `Serde Library`, `InputFormat`, +`OutputFormat`, `Storage Properties`, `Partition Provider`, `Partition Columns` and `Schema`. + +Users cannot use regular expression for table name if a partition specification is present and it will output +the given partition's file specific system information such as `Partition Parameters` and `Partition Statistics` + +### Syntax +{% highlight sql %} +SHOW TABLE EXTENDED [IN|FROM database_name] LIKE 'identifier_with_wildcards' [PARTITION(partition_spec)]; +{% endhighlight %} + +### Parameters +
+
IN|FROM database_name
+
+ Specifies database name. If not provided, will use the current database. +
+
LIKE string_pattern
+
+ Specifies a string pattern that is used to match the table in the database. +
+
PARTITION(partition_spec)
+
+ Specifies partition column and its value which is exists in the table. With this user cannot use regular expression for table name. +
+
+### Examples +{% highlight sql %} +-- Assumes `employee` table created with partitioned by column `grade` +-- +-------+--------+--+ +-- | name | grade | +-- +-------+--------+--+ +-- | sam | 1 | +-- | suj | 2 | +-- +-------+--------+--+ + + -- Show the details of the table +SHOW TABLE EXTENDED LIKE `employee`; ++--------+---------+-----------+--------------------------------------------------------------- +|database|tableName|isTemporary| information ++--------+---------+-----------+--------------------------------------------------------------- +|default |employee |false |Database: default + Table: employee + Owner: root + Created Time: Fri Aug 30 15:10:21 IST 2019 + Last Access: Thu Jan 01 05:30:00 IST 1970 + Created By: Spark 3.0.0-SNAPSHOT + Type: MANAGED + Provider: hive + Table Properties: [transient_lastDdlTime=1567158021] + Location: file:/opt/spark1/spark/spark-warehouse/employee + Serde Library: org.apache.hadoop.hive.serde2.lazy + .LazySimpleSerDe + InputFormat: org.apache.hadoop.mapred.TextInputFormat + OutputFormat: org.apache.hadoop.hive.ql.io + .HiveIgnoreKeyTextOutputFormat + Storage Properties: [serialization.format=1] + Partition Provider: Catalog + Partition Columns: [`grade`] + Schema: root + |-- name: string (nullable = true) + |-- grade: integer (nullable = true) + ++--------+---------+-----------+--------------------------------------------------------------- + +-- showing the multiple table details with pattern matching +SHOW TABLE EXTENDED LIKE `employe*`; ++--------+---------+-----------+--------------------------------------------------------------- +|database|tableName|isTemporary| information ++--------+---------+-----------+--------------------------------------------------------------- +|default |employee |false |Database: default + Table: employee + Owner: root + Created Time: Fri Aug 30 15:10:21 IST 2019 + Last Access: Thu Jan 01 05:30:00 IST 1970 + Created By: Spark 3.0.0-SNAPSHOT + Type: MANAGED + Provider: hive + Table Properties: [transient_lastDdlTime=1567158021] + Location: file:/opt/spark1/spark/spark-warehouse/employee + Serde Library: org.apache.hadoop.hive.serde2.lazy + .LazySimpleSerDe + InputFormat: org.apache.hadoop.mapred.TextInputFormat + OutputFormat: org.apache.hadoop.hive.ql.io + .HiveIgnoreKeyTextOutputFormat + Storage Properties: [serialization.format=1] + Partition Provider: Catalog + Partition Columns: [`grade`] + Schema: root + |-- name: string (nullable = true) + |-- grade: integer (nullable = true) + +|default |employee1|false |Database: default + Table: employee1 + Owner: root + Created Time: Fri Aug 30 15:22:33 IST 2019 + Last Access: Thu Jan 01 05:30:00 IST 1970 + Created By: Spark 3.0.0-SNAPSHOT + Type: MANAGED + Provider: hive + Table Properties: [transient_lastDdlTime=1567158753] + Location: file:/opt/spark1/spark/spark-warehouse/employee1 + Serde Library: org.apache.hadoop.hive.serde2.lazy + .LazySimpleSerDe + InputFormat: org.apache.hadoop.mapred.TextInputFormat + OutputFormat: org.apache.hadoop.hive.ql.io + .HiveIgnoreKeyTextOutputFormat + Storage Properties: [serialization.format=1] + Partition Provider: Catalog + Schema: root + |-- name: string (nullable = true) + ++--------+---------+----------+---------------------------------------------------------------- + +-- show partition file system details +SHOW TABLE EXTENDED IN `default` LIKE `employee` PARTITION (`grade=1`); ++--------+---------+-----------+--------------------------------------------------------------- +|database|tableName|isTemporary| information information | ++--------+---------+-----------+--------------------------------------------------------------- +|default |employee |false | Partition Values: [grade=1] + Location: file:/opt/spark1/spark/spark-warehouse/employee + /grade=1 + Serde Library: org.apache.hadoop.hive.serde2.lazy + .LazySimpleSerDe + InputFormat: org.apache.hadoop.mapred.TextInputFormat + OutputFormat: org.apache.hadoop.hive.ql.io + .HiveIgnoreKeyTextOutputFormat + Storage Properties: [serialization.format=1] + Partition Parameters: {rawDataSize=-1, numFiles=1, + transient_lastDdlTime=1567158221, totalSize=4, + COLUMN_STATS_ACCURATE=false, numRows=-1} + Created Time: Fri Aug 30 15:13:41 IST 2019 + Last Access: Thu Jan 01 05:30:00 IST 1970 + Partition Statistics: 4 bytes + | ++--------+---------+-----------+--------------------------------------------------------------- +{% endhighlight %} +### Related Statements +- [CREATE TABLE](sql-ref-syntax-ddl-create-table.html) +- [DESCRIBE TABLE](sql-ref-syntax-aux-describe-table.html) From b81aaf2748d269c58e4d470a8cbacd797db07549 Mon Sep 17 00:00:00 2001 From: shivusondur Date: Tue, 29 Oct 2019 23:27:12 +0530 Subject: [PATCH 2/4] handled the comments --- docs/sql-ref-syntax-aux-show-table.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/sql-ref-syntax-aux-show-table.md b/docs/sql-ref-syntax-aux-show-table.md index 6d59735da418..444685d2618b 100644 --- a/docs/sql-ref-syntax-aux-show-table.md +++ b/docs/sql-ref-syntax-aux-show-table.md @@ -20,13 +20,13 @@ license: | --- ### Description -SHOW TABLE EXTENDED will show information for all tables matching the given regular expression. +`SHOW TABLE EXTENDED` will show information for all tables matching the given regular expression. Output includes basic table information and file system information like `Last Access`, `Created By`, `Type`, `Provider`, `Table Properties`, `Location`, `Serde Library`, `InputFormat`, `OutputFormat`, `Storage Properties`, `Partition Provider`, `Partition Columns` and `Schema`. -Users cannot use regular expression for table name if a partition specification is present and it will output -the given partition's file specific system information such as `Partition Parameters` and `Partition Statistics` +Users cannot use regular expression for the table name if a partition specification is present. It will output +the given partition's file-system-specific information such as `Partition Parameters` and `Partition Statistics` ### Syntax {% highlight sql %} @@ -41,7 +41,13 @@ SHOW TABLE EXTENDED [IN|FROM database_name] LIKE 'identifier_with_wildcards' [PA
LIKE string_pattern
- Specifies a string pattern that is used to match the table in the database. + Specifies the regular expression pattern that is used to filter out unwanted tables. +
    +
  • Except for `*` and `|` character, the pattern works like a regex.
  • +
  • `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes, + any of which can match.
  • +
  • The leading and trailing blanks are trimmed in the input pattern before processing.
  • +
PARTITION(partition_spec)
From 90467acb24243e21dd31818ba02a72c3d42a4088 Mon Sep 17 00:00:00 2001 From: shivusondur Date: Thu, 31 Oct 2019 21:31:10 +0530 Subject: [PATCH 3/4] handled the comments --- docs/sql-ref-syntax-aux-show-table.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/sql-ref-syntax-aux-show-table.md b/docs/sql-ref-syntax-aux-show-table.md index 444685d2618b..985eff117e62 100644 --- a/docs/sql-ref-syntax-aux-show-table.md +++ b/docs/sql-ref-syntax-aux-show-table.md @@ -79,7 +79,7 @@ SHOW TABLE EXTENDED LIKE `employee`; Provider: hive Table Properties: [transient_lastDdlTime=1567158021] Location: file:/opt/spark1/spark/spark-warehouse/employee - Serde Library: org.apache.hadoop.hive.serde2.lazy + Serde Library: org.apache.hadoop.hive.serde2.lazy .LazySimpleSerDe InputFormat: org.apache.hadoop.mapred.TextInputFormat OutputFormat: org.apache.hadoop.hive.ql.io @@ -145,7 +145,7 @@ SHOW TABLE EXTENDED LIKE `employe*`; -- show partition file system details SHOW TABLE EXTENDED IN `default` LIKE `employee` PARTITION (`grade=1`); +--------+---------+-----------+--------------------------------------------------------------- -|database|tableName|isTemporary| information information | +|database|tableName|isTemporary| information +--------+---------+-----------+--------------------------------------------------------------- |default |employee |false | Partition Values: [grade=1] Location: file:/opt/spark1/spark/spark-warehouse/employee @@ -164,6 +164,12 @@ SHOW TABLE EXTENDED IN `default` LIKE `employee` PARTITION (`grade=1`); Partition Statistics: 4 bytes | +--------+---------+-----------+--------------------------------------------------------------- + +-- show partition file system details with regex fails as shown below +SHOW TABLE EXTENDED IN `default` LIKE `empl*` PARTITION (`grade=1`); +Error: Error running query: org.apache.spark.sql.catalyst.analysis.NoSuchTableException: + Table or view 'emplo*' not found in database 'default'; (state=,code=0) + {% endhighlight %} ### Related Statements - [CREATE TABLE](sql-ref-syntax-ddl-create-table.html) From 79db8ca276894ec4685f76fe81e162e87e4624b4 Mon Sep 17 00:00:00 2001 From: shivusondur Date: Mon, 4 Nov 2019 22:39:08 +0530 Subject: [PATCH 4/4] handled the comments --- docs/sql-ref-syntax-aux-show-table.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/sql-ref-syntax-aux-show-table.md b/docs/sql-ref-syntax-aux-show-table.md index 985eff117e62..1d881a73c811 100644 --- a/docs/sql-ref-syntax-aux-show-table.md +++ b/docs/sql-ref-syntax-aux-show-table.md @@ -25,8 +25,9 @@ Output includes basic table information and file system information like `Last A `Created By`, `Type`, `Provider`, `Table Properties`, `Location`, `Serde Library`, `InputFormat`, `OutputFormat`, `Storage Properties`, `Partition Provider`, `Partition Columns` and `Schema`. -Users cannot use regular expression for the table name if a partition specification is present. It will output -the given partition's file-system-specific information such as `Partition Parameters` and `Partition Statistics` +If a partition specification is present, it outputs the given partition's file-system-specific +information such as `Partition Parameters` and `Partition Statistics`. Note that a table regex +cannot be used with a partition specification. ### Syntax {% highlight sql %} @@ -51,7 +52,8 @@ SHOW TABLE EXTENDED [IN|FROM database_name] LIKE 'identifier_with_wildcards' [PA
PARTITION(partition_spec)
- Specifies partition column and its value which is exists in the table. With this user cannot use regular expression for table name. + Specifies partition column and its value which is exists in the table. Note that a table regex + cannot be used with a partition specification..
### Examples