aboutsummaryrefslogtreecommitdiff
path: root/sql/core/src/test/resources/sql-tests/results
diff options
context:
space:
mode:
authorXiao Li <gatorsmile@gmail.com>2017-04-03 23:30:12 -0700
committerXiao Li <gatorsmile@gmail.com>2017-04-03 23:30:12 -0700
commit51d3c854c54369aec1bfd55cefcd080dcd178d5f (patch)
tree8c83dc8698f16b4af724fe4f8a1a7901224bdffb /sql/core/src/test/resources/sql-tests/results
parent3bfb639cb7352aec572ef6686d3471bd78748ffa (diff)
downloadspark-51d3c854c54369aec1bfd55cefcd080dcd178d5f.tar.gz
spark-51d3c854c54369aec1bfd55cefcd080dcd178d5f.tar.bz2
spark-51d3c854c54369aec1bfd55cefcd080dcd178d5f.zip
[SPARK-20067][SQL] Unify and Clean Up Desc Commands Using Catalog Interface
### What changes were proposed in this pull request? This PR is to unify and clean up the outputs of `DESC EXTENDED/FORMATTED` and `SHOW TABLE EXTENDED` by moving the logics into the Catalog interface. The output formats are improved. We also add the missing attributes. It impacts the DDL commands like `SHOW TABLE EXTENDED`, `DESC EXTENDED` and `DESC FORMATTED`. In addition, by following what we did in Dataset API `printSchema`, we can use `treeString` to show the schema in the more readable way. Below is the current way: ``` Schema: STRUCT<`a`: STRING (nullable = true), `b`: INT (nullable = true), `c`: STRING (nullable = true), `d`: STRING (nullable = true)> ``` After the change, it should look like ``` Schema: root |-- a: string (nullable = true) |-- b: integer (nullable = true) |-- c: string (nullable = true) |-- d: string (nullable = true) ``` ### How was this patch tested? `describe.sql` and `show-tables.sql` Author: Xiao Li <gatorsmile@gmail.com> Closes #17394 from gatorsmile/descFollowUp.
Diffstat (limited to 'sql/core/src/test/resources/sql-tests/results')
-rw-r--r--sql/core/src/test/resources/sql-tests/results/change-column.sql.out9
-rw-r--r--sql/core/src/test/resources/sql-tests/results/describe.sql.out422
-rw-r--r--sql/core/src/test/resources/sql-tests/results/show-tables.sql.out67
3 files changed, 375 insertions, 123 deletions
diff --git a/sql/core/src/test/resources/sql-tests/results/change-column.sql.out b/sql/core/src/test/resources/sql-tests/results/change-column.sql.out
index ba8bc936f0..678a3f0f0a 100644
--- a/sql/core/src/test/resources/sql-tests/results/change-column.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/change-column.sql.out
@@ -15,6 +15,7 @@ DESC test_change
-- !query 1 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 1 output
+# col_name data_type comment
a int
b string
c int
@@ -34,6 +35,7 @@ DESC test_change
-- !query 3 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 3 output
+# col_name data_type comment
a int
b string
c int
@@ -53,6 +55,7 @@ DESC test_change
-- !query 5 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 5 output
+# col_name data_type comment
a int
b string
c int
@@ -91,6 +94,7 @@ DESC test_change
-- !query 8 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 8 output
+# col_name data_type comment
a int
b string
c int
@@ -125,6 +129,7 @@ DESC test_change
-- !query 12 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 12 output
+# col_name data_type comment
a int this is column a
b string #*02?`
c int
@@ -143,6 +148,7 @@ DESC test_change
-- !query 14 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 14 output
+# col_name data_type comment
a int this is column a
b string #*02?`
c int
@@ -162,6 +168,7 @@ DESC test_change
-- !query 16 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 16 output
+# col_name data_type comment
a int this is column a
b string #*02?`
c int
@@ -186,6 +193,7 @@ DESC test_change
-- !query 18 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 18 output
+# col_name data_type comment
a int this is column a
b string #*02?`
c int
@@ -229,6 +237,7 @@ DESC test_change
-- !query 23 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 23 output
+# col_name data_type comment
a int this is column A
b string #*02?`
c int
diff --git a/sql/core/src/test/resources/sql-tests/results/describe.sql.out b/sql/core/src/test/resources/sql-tests/results/describe.sql.out
index 422d548ea8..de10b29f3c 100644
--- a/sql/core/src/test/resources/sql-tests/results/describe.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/describe.sql.out
@@ -1,9 +1,11 @@
-- Automatically generated by SQLQueryTestSuite
--- Number of queries: 14
+-- Number of queries: 31
-- !query 0
-CREATE TABLE t (a STRING, b INT, c STRING, d STRING) USING parquet PARTITIONED BY (c, d) COMMENT 'table_comment'
+CREATE TABLE t (a STRING, b INT, c STRING, d STRING) USING parquet
+ PARTITIONED BY (c, d) CLUSTERED BY (a) SORTED BY (b ASC) INTO 2 BUCKETS
+ COMMENT 'table_comment'
-- !query 0 schema
struct<>
-- !query 0 output
@@ -11,7 +13,7 @@ struct<>
-- !query 1
-ALTER TABLE t ADD PARTITION (c='Us', d=1)
+CREATE TEMPORARY VIEW temp_v AS SELECT * FROM t
-- !query 1 schema
struct<>
-- !query 1 output
@@ -19,187 +21,239 @@ struct<>
-- !query 2
-DESCRIBE t
+CREATE TEMPORARY VIEW temp_Data_Source_View
+ USING org.apache.spark.sql.sources.DDLScanSource
+ OPTIONS (
+ From '1',
+ To '10',
+ Table 'test1')
-- !query 2 schema
-struct<col_name:string,data_type:string,comment:string>
+struct<>
-- !query 2 output
-# Partition Information
+
+
+
+-- !query 3
+CREATE VIEW v AS SELECT * FROM t
+-- !query 3 schema
+struct<>
+-- !query 3 output
+
+
+
+-- !query 4
+ALTER TABLE t ADD PARTITION (c='Us', d=1)
+-- !query 4 schema
+struct<>
+-- !query 4 output
+
+
+
+-- !query 5
+DESCRIBE t
+-- !query 5 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 5 output
# col_name data_type comment
a string
b int
c string
-c string
d string
+# Partition Information
+# col_name data_type comment
+c string
d string
--- !query 3
-DESC t
--- !query 3 schema
+-- !query 6
+DESC default.t
+-- !query 6 schema
struct<col_name:string,data_type:string,comment:string>
--- !query 3 output
-# Partition Information
+-- !query 6 output
# col_name data_type comment
a string
b int
c string
-c string
d string
+# Partition Information
+# col_name data_type comment
+c string
d string
--- !query 4
+-- !query 7
DESC TABLE t
--- !query 4 schema
+-- !query 7 schema
struct<col_name:string,data_type:string,comment:string>
--- !query 4 output
-# Partition Information
+-- !query 7 output
# col_name data_type comment
a string
b int
c string
-c string
d string
+# Partition Information
+# col_name data_type comment
+c string
d string
--- !query 5
+-- !query 8
DESC FORMATTED t
--- !query 5 schema
+-- !query 8 schema
struct<col_name:string,data_type:string,comment:string>
--- !query 5 output
-# Detailed Table Information
-# Partition Information
-# Storage Information
+-- !query 8 output
# col_name data_type comment
-Comment: table_comment
-Compressed: No
-Created:
-Database: default
-Last Access:
-Location: sql/core/spark-warehouse/t
-Owner:
-Partition Provider: Catalog
-Storage Desc Parameters:
-Table Parameters:
-Table Type: MANAGED
a string
b int
c string
+d string
+# Partition Information
+# col_name data_type comment
c string
d string
-d string
+
+# Detailed Table Information
+Database default
+Table t
+Created [not included in comparison]
+Last Access [not included in comparison]
+Type MANAGED
+Provider parquet
+Num Buckets 2
+Bucket Columns [`a`]
+Sort Columns [`b`]
+Comment table_comment
+Location [not included in comparison]sql/core/spark-warehouse/t
+Partition Provider Catalog
--- !query 6
+-- !query 9
DESC EXTENDED t
--- !query 6 schema
+-- !query 9 schema
struct<col_name:string,data_type:string,comment:string>
--- !query 6 output
-# Detailed Table Information CatalogTable(
- Table: `default`.`t`
- Created:
- Last Access:
- Type: MANAGED
- Schema: [StructField(a,StringType,true), StructField(b,IntegerType,true), StructField(c,StringType,true), StructField(d,StringType,true)]
- Provider: parquet
- Partition Columns: [`c`, `d`]
- Comment: table_comment
- Storage(Location: sql/core/spark-warehouse/t)
- Partition Provider: Catalog)
-# Partition Information
+-- !query 9 output
# col_name data_type comment
a string
b int
c string
+d string
+# Partition Information
+# col_name data_type comment
c string
d string
-d string
+
+# Detailed Table Information
+Database default
+Table t
+Created [not included in comparison]
+Last Access [not included in comparison]
+Type MANAGED
+Provider parquet
+Num Buckets 2
+Bucket Columns [`a`]
+Sort Columns [`b`]
+Comment table_comment
+Location [not included in comparison]sql/core/spark-warehouse/t
+Partition Provider Catalog
--- !query 7
+-- !query 10
DESC t PARTITION (c='Us', d=1)
--- !query 7 schema
+-- !query 10 schema
struct<col_name:string,data_type:string,comment:string>
--- !query 7 output
-# Partition Information
+-- !query 10 output
# col_name data_type comment
a string
b int
c string
-c string
d string
+# Partition Information
+# col_name data_type comment
+c string
d string
--- !query 8
+-- !query 11
DESC EXTENDED t PARTITION (c='Us', d=1)
--- !query 8 schema
+-- !query 11 schema
struct<col_name:string,data_type:string,comment:string>
--- !query 8 output
-# Partition Information
+-- !query 11 output
# col_name data_type comment
-Detailed Partition Information CatalogPartition(
- Partition Values: [c=Us, d=1]
- Storage(Location: sql/core/spark-warehouse/t/c=Us/d=1)
- Partition Parameters:{})
a string
b int
c string
+d string
+# Partition Information
+# col_name data_type comment
c string
d string
-d string
+
+# Detailed Partition Information
+Database default
+Table t
+Partition Values [c=Us, d=1]
+Location [not included in comparison]sql/core/spark-warehouse/t/c=Us/d=1
+
+# Storage Information
+Num Buckets 2
+Bucket Columns [`a`]
+Sort Columns [`b`]
+Location [not included in comparison]sql/core/spark-warehouse/t
--- !query 9
+-- !query 12
DESC FORMATTED t PARTITION (c='Us', d=1)
--- !query 9 schema
+-- !query 12 schema
struct<col_name:string,data_type:string,comment:string>
--- !query 9 output
-# Detailed Partition Information
-# Partition Information
-# Storage Information
+-- !query 12 output
# col_name data_type comment
-Compressed: No
-Database: default
-Location: sql/core/spark-warehouse/t/c=Us/d=1
-Partition Parameters:
-Partition Value: [Us, 1]
-Storage Desc Parameters:
-Table: t
a string
b int
c string
+d string
+# Partition Information
+# col_name data_type comment
c string
d string
-d string
+
+# Detailed Partition Information
+Database default
+Table t
+Partition Values [c=Us, d=1]
+Location [not included in comparison]sql/core/spark-warehouse/t/c=Us/d=1
+
+# Storage Information
+Num Buckets 2
+Bucket Columns [`a`]
+Sort Columns [`b`]
+Location [not included in comparison]sql/core/spark-warehouse/t
--- !query 10
+-- !query 13
DESC t PARTITION (c='Us', d=2)
--- !query 10 schema
+-- !query 13 schema
struct<>
--- !query 10 output
+-- !query 13 output
org.apache.spark.sql.catalyst.analysis.NoSuchPartitionException
Partition not found in table 't' database 'default':
c -> Us
d -> 2;
--- !query 11
+-- !query 14
DESC t PARTITION (c='Us')
--- !query 11 schema
+-- !query 14 schema
struct<>
--- !query 11 output
+-- !query 14 output
org.apache.spark.sql.AnalysisException
Partition spec is invalid. The spec (c) must match the partition spec (c, d) defined in table '`default`.`t`';
--- !query 12
+-- !query 15
DESC t PARTITION (c='Us', d)
--- !query 12 schema
+-- !query 15 schema
struct<>
--- !query 12 output
+-- !query 15 output
org.apache.spark.sql.catalyst.parser.ParseException
PARTITION specification is incomplete: `d`(line 1, pos 0)
@@ -209,9 +263,193 @@ DESC t PARTITION (c='Us', d)
^^^
--- !query 13
+-- !query 16
+DESC temp_v
+-- !query 16 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 16 output
+# col_name data_type comment
+a string
+b int
+c string
+d string
+
+
+-- !query 17
+DESC TABLE temp_v
+-- !query 17 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 17 output
+# col_name data_type comment
+a string
+b int
+c string
+d string
+
+
+-- !query 18
+DESC FORMATTED temp_v
+-- !query 18 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 18 output
+# col_name data_type comment
+a string
+b int
+c string
+d string
+
+
+-- !query 19
+DESC EXTENDED temp_v
+-- !query 19 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 19 output
+# col_name data_type comment
+a string
+b int
+c string
+d string
+
+
+-- !query 20
+DESC temp_Data_Source_View
+-- !query 20 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 20 output
+# col_name data_type comment
+intType int test comment test1
+stringType string
+dateType date
+timestampType timestamp
+doubleType double
+bigintType bigint
+tinyintType tinyint
+decimalType decimal(10,0)
+fixedDecimalType decimal(5,1)
+binaryType binary
+booleanType boolean
+smallIntType smallint
+floatType float
+mapType map<string,string>
+arrayType array<string>
+structType struct<f1:string,f2:int>
+
+
+-- !query 21
+DESC temp_v PARTITION (c='Us', d=1)
+-- !query 21 schema
+struct<>
+-- !query 21 output
+org.apache.spark.sql.AnalysisException
+DESC PARTITION is not allowed on a temporary view: temp_v;
+
+
+-- !query 22
+DESC v
+-- !query 22 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 22 output
+# col_name data_type comment
+a string
+b int
+c string
+d string
+
+
+-- !query 23
+DESC TABLE v
+-- !query 23 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 23 output
+# col_name data_type comment
+a string
+b int
+c string
+d string
+
+
+-- !query 24
+DESC FORMATTED v
+-- !query 24 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 24 output
+# col_name data_type comment
+a string
+b int
+c string
+d string
+
+# Detailed Table Information
+Database default
+Table v
+Created [not included in comparison]
+Last Access [not included in comparison]
+Type VIEW
+View Text SELECT * FROM t
+View Default Database default
+View Query Output Columns [a, b, c, d]
+Properties [view.query.out.col.3=d, view.query.out.col.0=a, view.query.out.numCols=4, view.default.database=default, view.query.out.col.1=b, view.query.out.col.2=c]
+
+
+-- !query 25
+DESC EXTENDED v
+-- !query 25 schema
+struct<col_name:string,data_type:string,comment:string>
+-- !query 25 output
+# col_name data_type comment
+a string
+b int
+c string
+d string
+
+# Detailed Table Information
+Database default
+Table v
+Created [not included in comparison]
+Last Access [not included in comparison]
+Type VIEW
+View Text SELECT * FROM t
+View Default Database default
+View Query Output Columns [a, b, c, d]
+Properties [view.query.out.col.3=d, view.query.out.col.0=a, view.query.out.numCols=4, view.default.database=default, view.query.out.col.1=b, view.query.out.col.2=c]
+
+
+-- !query 26
+DESC v PARTITION (c='Us', d=1)
+-- !query 26 schema
+struct<>
+-- !query 26 output
+org.apache.spark.sql.AnalysisException
+DESC PARTITION is not allowed on a view: v;
+
+
+-- !query 27
DROP TABLE t
--- !query 13 schema
+-- !query 27 schema
struct<>
--- !query 13 output
+-- !query 27 output
+
+
+
+-- !query 28
+DROP VIEW temp_v
+-- !query 28 schema
+struct<>
+-- !query 28 output
+
+
+
+-- !query 29
+DROP VIEW temp_Data_Source_View
+-- !query 29 schema
+struct<>
+-- !query 29 output
+
+
+
+-- !query 30
+DROP VIEW v
+-- !query 30 schema
+struct<>
+-- !query 30 output
diff --git a/sql/core/src/test/resources/sql-tests/results/show-tables.sql.out b/sql/core/src/test/resources/sql-tests/results/show-tables.sql.out
index 6d62e60921..8f2a54f7c2 100644
--- a/sql/core/src/test/resources/sql-tests/results/show-tables.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/show-tables.sql.out
@@ -118,33 +118,40 @@ SHOW TABLE EXTENDED LIKE 'show_t*'
-- !query 12 schema
struct<database:string,tableName:string,isTemporary:boolean,information:string>
-- !query 12 output
-show_t3 true CatalogTable(
- Table: `show_t3`
- Created:
- Last Access:
- Type: VIEW
- Schema: [StructField(e,IntegerType,true)]
- Storage())
-
-showdb show_t1 false CatalogTable(
- Table: `showdb`.`show_t1`
- Created:
- Last Access:
- Type: MANAGED
- Schema: [StructField(a,StringType,true), StructField(b,IntegerType,true), StructField(c,StringType,true), StructField(d,StringType,true)]
- Provider: parquet
- Partition Columns: [`c`, `d`]
- Storage(Location: sql/core/spark-warehouse/showdb.db/show_t1)
- Partition Provider: Catalog)
-
-showdb show_t2 false CatalogTable(
- Table: `showdb`.`show_t2`
- Created:
- Last Access:
- Type: MANAGED
- Schema: [StructField(b,StringType,true), StructField(d,IntegerType,true)]
- Provider: parquet
- Storage(Location: sql/core/spark-warehouse/showdb.db/show_t2))
+show_t3 true Table: show_t3
+Created [not included in comparison]
+Last Access [not included in comparison]
+Type: VIEW
+Schema: root
+ |-- e: integer (nullable = true)
+
+
+showdb show_t1 false Database: showdb
+Table: show_t1
+Created [not included in comparison]
+Last Access [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Location [not included in comparison]sql/core/spark-warehouse/showdb.db/show_t1
+Partition Provider: Catalog
+Partition Columns: [`c`, `d`]
+Schema: root
+ |-- a: string (nullable = true)
+ |-- b: integer (nullable = true)
+ |-- c: string (nullable = true)
+ |-- d: string (nullable = true)
+
+
+showdb show_t2 false Database: showdb
+Table: show_t2
+Created [not included in comparison]
+Last Access [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Location [not included in comparison]sql/core/spark-warehouse/showdb.db/show_t2
+Schema: root
+ |-- b: string (nullable = true)
+ |-- d: integer (nullable = true)
-- !query 13
@@ -166,10 +173,8 @@ SHOW TABLE EXTENDED LIKE 'show_t1' PARTITION(c='Us', d=1)
-- !query 14 schema
struct<database:string,tableName:string,isTemporary:boolean,information:string>
-- !query 14 output
-showdb show_t1 false CatalogPartition(
- Partition Values: [c=Us, d=1]
- Storage(Location: sql/core/spark-warehouse/showdb.db/show_t1/c=Us/d=1)
- Partition Parameters:{})
+showdb show_t1 false Partition Values: [c=Us, d=1]
+Location [not included in comparison]sql/core/spark-warehouse/showdb.db/show_t1/c=Us/d=1
-- !query 15