Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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:
* {{{
Expand Down Expand Up @@ -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:
* {{{
Expand Down Expand Up @@ -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)]
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<x:int, y:string>) USING PARQUET;
CREATE TABLE desc_complex_col_table (`a.b` int, col struct<x:int, y:string>) 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;
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
-- 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



-- !query 1
DESC desc_col_temp_table key
DESC desc_col_temp_view key
-- !query 1 schema
struct<info_name:string,info_value:string>
-- !query 1 output
Expand All @@ -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<info_name:string,info_value:string>
-- !query 2 output
Expand All @@ -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<info_name:string,info_value:string>
-- !query 3 output
Expand All @@ -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<info_name:string,info_value:string>
-- !query 4 output
Expand All @@ -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
Expand Down Expand Up @@ -136,15 +136,15 @@ max_col_len 4


-- !query 11
CREATE TABLE desc_col_complex_table (`a.b` int, col struct<x:int, y:string>) USING PARQUET
CREATE TABLE desc_complex_col_table (`a.b` int, col struct<x:int, y:string>) USING PARQUET
-- !query 11 schema
struct<>
-- !query 11 output



-- !query 12
DESC FORMATTED desc_col_complex_table `a.b`
DESC FORMATTED desc_complex_col_table `a.b`
-- !query 12 schema
struct<info_name:string,info_value:string>
-- !query 12 output
Expand All @@ -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<info_name:string,info_value:string>
-- !query 13 output
Expand All @@ -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