diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala index da0c815581d53..8d95ca6921cf8 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala @@ -632,8 +632,7 @@ case class DescribeTableCommand( } /** - * A command to list the info for a column, including name, data type, column stats and comment. - * This function creates a [[DescribeColumnCommand]] logical plan. + * A command to list the info for a column, including name, data type, comment and column stats. * * The syntax of using this command in SQL is: * {{{ @@ -809,8 +808,7 @@ case class ShowTablePropertiesCommand(table: TableIdentifier, propertyKey: Optio } /** - * A command to list the column names for a table. This function creates a - * [[ShowColumnsCommand]] logical plan. + * A command to list the column names for a table. * * The syntax of using this command in SQL is: * {{{ @@ -849,8 +847,6 @@ case class ShowColumnsCommand( * 1. If the command is called for a non partitioned table. * 2. If the partition spec refers to the columns that are not defined as partitioning columns. * - * This function creates a [[ShowPartitionsCommand]] logical plan - * * The syntax of using this command in SQL is: * {{{ * SHOW PARTITIONS [db_name.]table_name [PARTITION(partition_spec)] diff --git a/sql/core/src/test/resources/sql-tests/inputs/describe-table-column.sql b/sql/core/src/test/resources/sql-tests/inputs/describe-table-column.sql index 24870def0316e..a6ddcd999bf9b 100644 --- a/sql/core/src/test/resources/sql-tests/inputs/describe-table-column.sql +++ b/sql/core/src/test/resources/sql-tests/inputs/describe-table-column.sql @@ -1,17 +1,17 @@ -- Test temp table -CREATE TEMPORARY VIEW desc_col_temp_table (key int COMMENT 'column_comment') USING PARQUET; +CREATE TEMPORARY VIEW desc_col_temp_view (key int COMMENT 'column_comment') USING PARQUET; -DESC desc_col_temp_table key; +DESC desc_col_temp_view key; -DESC EXTENDED desc_col_temp_table key; +DESC EXTENDED desc_col_temp_view key; -DESC FORMATTED desc_col_temp_table key; +DESC FORMATTED desc_col_temp_view key; -- Describe a column with qualified name -DESC FORMATTED desc_col_temp_table desc_col_temp_table.key; +DESC FORMATTED desc_col_temp_view desc_col_temp_view.key; -- Describe a non-existent column -DESC desc_col_temp_table key1; +DESC desc_col_temp_view key1; -- Test persistent table CREATE TABLE desc_col_table (key int COMMENT 'column_comment') USING PARQUET; @@ -25,11 +25,17 @@ DESC EXTENDED desc_col_table key; DESC FORMATTED desc_col_table key; -- Test complex columns -CREATE TABLE desc_col_complex_table (`a.b` int, col struct) USING PARQUET; +CREATE TABLE desc_complex_col_table (`a.b` int, col struct) USING PARQUET; -DESC FORMATTED desc_col_complex_table `a.b`; +DESC FORMATTED desc_complex_col_table `a.b`; -DESC FORMATTED desc_col_complex_table col; +DESC FORMATTED desc_complex_col_table col; -- Describe a nested column -DESC FORMATTED desc_col_complex_table col.x; +DESC FORMATTED desc_complex_col_table col.x; + +DROP VIEW desc_col_temp_view; + +DROP TABLE desc_col_table; + +DROP TABLE desc_complex_col_table; diff --git a/sql/core/src/test/resources/sql-tests/results/describe-table-column.sql.out b/sql/core/src/test/resources/sql-tests/results/describe-table-column.sql.out index a51eef7c7e1f6..30d0a2dc5a3f7 100644 --- a/sql/core/src/test/resources/sql-tests/results/describe-table-column.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/describe-table-column.sql.out @@ -1,9 +1,9 @@ -- Automatically generated by SQLQueryTestSuite --- Number of queries: 15 +-- Number of queries: 18 -- !query 0 -CREATE TEMPORARY VIEW desc_col_temp_table (key int COMMENT 'column_comment') USING PARQUET +CREATE TEMPORARY VIEW desc_col_temp_view (key int COMMENT 'column_comment') USING PARQUET -- !query 0 schema struct<> -- !query 0 output @@ -11,7 +11,7 @@ struct<> -- !query 1 -DESC desc_col_temp_table key +DESC desc_col_temp_view key -- !query 1 schema struct -- !query 1 output @@ -21,7 +21,7 @@ comment column_comment -- !query 2 -DESC EXTENDED desc_col_temp_table key +DESC EXTENDED desc_col_temp_view key -- !query 2 schema struct -- !query 2 output @@ -37,7 +37,7 @@ max_col_len NULL -- !query 3 -DESC FORMATTED desc_col_temp_table key +DESC FORMATTED desc_col_temp_view key -- !query 3 schema struct -- !query 3 output @@ -53,7 +53,7 @@ max_col_len NULL -- !query 4 -DESC FORMATTED desc_col_temp_table desc_col_temp_table.key +DESC FORMATTED desc_col_temp_view desc_col_temp_view.key -- !query 4 schema struct -- !query 4 output @@ -69,7 +69,7 @@ max_col_len NULL -- !query 5 -DESC desc_col_temp_table key1 +DESC desc_col_temp_view key1 -- !query 5 schema struct<> -- !query 5 output @@ -136,7 +136,7 @@ max_col_len 4 -- !query 11 -CREATE TABLE desc_col_complex_table (`a.b` int, col struct) USING PARQUET +CREATE TABLE desc_complex_col_table (`a.b` int, col struct) USING PARQUET -- !query 11 schema struct<> -- !query 11 output @@ -144,7 +144,7 @@ struct<> -- !query 12 -DESC FORMATTED desc_col_complex_table `a.b` +DESC FORMATTED desc_complex_col_table `a.b` -- !query 12 schema struct -- !query 12 output @@ -160,7 +160,7 @@ max_col_len NULL -- !query 13 -DESC FORMATTED desc_col_complex_table col +DESC FORMATTED desc_complex_col_table col -- !query 13 schema struct -- !query 13 output @@ -176,9 +176,33 @@ max_col_len NULL -- !query 14 -DESC FORMATTED desc_col_complex_table col.x +DESC FORMATTED desc_complex_col_table col.x -- !query 14 schema struct<> -- !query 14 output org.apache.spark.sql.AnalysisException DESC TABLE COLUMN command does not support nested data types: col.x; + + +-- !query 15 +DROP VIEW desc_col_temp_view +-- !query 15 schema +struct<> +-- !query 15 output + + + +-- !query 16 +DROP TABLE desc_col_table +-- !query 16 schema +struct<> +-- !query 16 output + + + +-- !query 17 +DROP TABLE desc_complex_col_table +-- !query 17 schema +struct<> +-- !query 17 output +