-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-17612][SQL] Support
DESCRIBE table PARTITION
SQL syntax
- Loading branch information
1 parent
a9165bb
commit e5f7ced
Showing
6 changed files
with
287 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
CREATE TABLE t (a STRING, b INT) PARTITIONED BY (c STRING, d STRING); | ||
|
||
ALTER TABLE t ADD PARTITION (c='Us', d=1); | ||
|
||
DESC t; | ||
|
||
-- Ignore these because there exist timestamp results, e.g., `Create Table`. | ||
-- DESC EXTENDED t; | ||
-- DESC FORMATTED t; | ||
|
||
DESC t PARTITION (c='Us', d=1); | ||
|
||
-- Ignore these because there exist timestamp results, e.g., transient_lastDdlTime. | ||
-- DESC EXTENDED t PARTITION (c='Us', d=1); | ||
-- DESC FORMATTED t PARTITION (c='Us', d=1); | ||
|
||
-- NoSuchPartitionException: Partition not found in table | ||
DESC t PARTITION (c='Us', d=2); | ||
|
||
-- AnalysisException: Partition spec is invalid | ||
DESC t PARTITION (c='Us'); | ||
|
||
-- ParseException: PARTITION specification is incomplete | ||
DESC t PARTITION (c='Us', d); | ||
|
||
-- DROP TEST TABLE | ||
DROP TABLE t; |
90 changes: 90 additions & 0 deletions
90
sql/core/src/test/resources/sql-tests/results/describe.sql.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
-- Automatically generated by SQLQueryTestSuite | ||
-- Number of queries: 8 | ||
|
||
|
||
-- !query 0 | ||
CREATE TABLE t (a STRING, b INT) PARTITIONED BY (c STRING, d STRING) | ||
-- !query 0 schema | ||
struct<> | ||
-- !query 0 output | ||
|
||
|
||
|
||
-- !query 1 | ||
ALTER TABLE t ADD PARTITION (c='Us', d=1) | ||
-- !query 1 schema | ||
struct<> | ||
-- !query 1 output | ||
|
||
|
||
|
||
-- !query 2 | ||
DESC t | ||
-- !query 2 schema | ||
struct<col_name:string,data_type:string,comment:string> | ||
-- !query 2 output | ||
# Partition Information | ||
# col_name data_type comment | ||
a string | ||
b int | ||
c string | ||
c string | ||
d string | ||
d string | ||
|
||
|
||
-- !query 3 | ||
DESC t PARTITION (c='Us', d=1) | ||
-- !query 3 schema | ||
struct<col_name:string,data_type:string,comment:string> | ||
-- !query 3 output | ||
# Partition Information | ||
# col_name data_type comment | ||
a string | ||
b int | ||
c string | ||
c string | ||
d string | ||
d string | ||
|
||
|
||
-- !query 4 | ||
DESC t PARTITION (c='Us', d=2) | ||
-- !query 4 schema | ||
struct<> | ||
-- !query 4 output | ||
org.apache.spark.sql.catalyst.analysis.NoSuchPartitionException | ||
Partition not found in table 't' database 'default': | ||
c -> Us | ||
d -> 2; | ||
|
||
|
||
-- !query 5 | ||
DESC t PARTITION (c='Us') | ||
-- !query 5 schema | ||
struct<> | ||
-- !query 5 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 6 | ||
DESC t PARTITION (c='Us', d) | ||
-- !query 6 schema | ||
struct<> | ||
-- !query 6 output | ||
org.apache.spark.sql.catalyst.parser.ParseException | ||
|
||
PARTITION specification is incomplete: `d`(line 1, pos 0) | ||
|
||
== SQL == | ||
DESC t PARTITION (c='Us', d) | ||
^^^ | ||
|
||
|
||
-- !query 7 | ||
DROP TABLE t | ||
-- !query 7 schema | ||
struct<> | ||
-- !query 7 output | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters