forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-2817] [SQL] add "show create table" support
In spark sql component, the "show create table" syntax had been disabled. We thought it is a useful funciton to describe a hive table. Author: tianyi <[email protected]> Author: tianyi <[email protected]> Author: tianyi <[email protected]> Closes apache#1760 from tianyi/spark-2817 and squashes the following commits: 7d28b15 [tianyi] [SPARK-2817] fix too short prefix problem cbffe8b [tianyi] [SPARK-2817] fix the case problem 565ec14 [tianyi] [SPARK-2817] fix the case problem 60d48a9 [tianyi] [SPARK-2817] use system temporary folder instead of temporary files in the source tree, and also clean some empty line dbe1031 [tianyi] [SPARK-2817] move some code out of function rewritePaths, as it may be called multiple times 9b2ba11 [tianyi] [SPARK-2817] fix the line length problem 9f97586 [tianyi] [SPARK-2817] remove test.tmp.dir from pom.xml bfc2999 [tianyi] [SPARK-2817] add "File.separator" support, create a "testTmpDir" outside the rewritePaths bde800a [tianyi] [SPARK-2817] add "${system:test.tmp.dir}" support add "last_modified_by" to nonDeterministicLineIndicators in HiveComparisonTest bb82726 [tianyi] [SPARK-2817] remove test which requires a system from the whitelist. bbf6b42 [tianyi] [SPARK-2817] add a systemProperties named "test.tmp.dir" to pass the test which contains "${system:test.tmp.dir}" a337bd6 [tianyi] [SPARK-2817] add "show create table" support a03db77 [tianyi] [SPARK-2817] add "show create table" support
- Loading branch information
1 parent
3d82b21
commit ef0ed9e
Showing
37 changed files
with
199 additions
and
0 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
Empty file.
18 changes: 18 additions & 0 deletions
18
...hive/src/test/resources/golden/show_create_table_alter-1-2a91d52719cf4552ebeb867204552a26
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,18 @@ | ||
CREATE EXTERNAL TABLE tmp_showcrt1( | ||
key smallint, | ||
value float) | ||
CLUSTERED BY ( | ||
key) | ||
SORTED BY ( | ||
value DESC) | ||
INTO 5 BUCKETS | ||
ROW FORMAT SERDE | ||
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' | ||
STORED AS INPUTFORMAT | ||
'org.apache.hadoop.mapred.TextInputFormat' | ||
OUTPUTFORMAT | ||
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' | ||
LOCATION | ||
'file:/tmp/sparkHiveWarehouse1280221975983654134/tmp_showcrt1' | ||
TBLPROPERTIES ( | ||
'transient_lastDdlTime'='1407132100') |
Empty file.
Empty file.
22 changes: 22 additions & 0 deletions
22
...hive/src/test/resources/golden/show_create_table_alter-3-2a91d52719cf4552ebeb867204552a26
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,22 @@ | ||
CREATE TABLE tmp_showcrt1( | ||
key smallint, | ||
value float) | ||
COMMENT 'temporary table' | ||
CLUSTERED BY ( | ||
key) | ||
SORTED BY ( | ||
value DESC) | ||
INTO 5 BUCKETS | ||
ROW FORMAT SERDE | ||
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' | ||
STORED AS INPUTFORMAT | ||
'org.apache.hadoop.mapred.TextInputFormat' | ||
OUTPUTFORMAT | ||
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' | ||
LOCATION | ||
'file:/tmp/sparkHiveWarehouse1280221975983654134/tmp_showcrt1' | ||
TBLPROPERTIES ( | ||
'EXTERNAL'='FALSE', | ||
'last_modified_by'='tianyi', | ||
'last_modified_time'='1407132100', | ||
'transient_lastDdlTime'='1407132100') |
Empty file.
21 changes: 21 additions & 0 deletions
21
...hive/src/test/resources/golden/show_create_table_alter-5-2a91d52719cf4552ebeb867204552a26
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,21 @@ | ||
CREATE EXTERNAL TABLE tmp_showcrt1( | ||
key smallint, | ||
value float) | ||
COMMENT 'changed comment' | ||
CLUSTERED BY ( | ||
key) | ||
SORTED BY ( | ||
value DESC) | ||
INTO 5 BUCKETS | ||
ROW FORMAT SERDE | ||
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' | ||
STORED AS INPUTFORMAT | ||
'org.apache.hadoop.mapred.TextInputFormat' | ||
OUTPUTFORMAT | ||
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' | ||
LOCATION | ||
'file:/tmp/sparkHiveWarehouse1280221975983654134/tmp_showcrt1' | ||
TBLPROPERTIES ( | ||
'last_modified_by'='tianyi', | ||
'last_modified_time'='1407132100', | ||
'transient_lastDdlTime'='1407132100') |
Empty file.
21 changes: 21 additions & 0 deletions
21
...hive/src/test/resources/golden/show_create_table_alter-7-2a91d52719cf4552ebeb867204552a26
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,21 @@ | ||
CREATE EXTERNAL TABLE tmp_showcrt1( | ||
key smallint, | ||
value float) | ||
COMMENT 'changed comment' | ||
CLUSTERED BY ( | ||
key) | ||
SORTED BY ( | ||
value DESC) | ||
INTO 5 BUCKETS | ||
ROW FORMAT SERDE | ||
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' | ||
STORED AS INPUTFORMAT | ||
'org.apache.hadoop.mapred.TextInputFormat' | ||
OUTPUTFORMAT | ||
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' | ||
LOCATION | ||
'file:/tmp/sparkHiveWarehouse1280221975983654134/tmp_showcrt1' | ||
TBLPROPERTIES ( | ||
'last_modified_by'='tianyi', | ||
'last_modified_time'='1407132101', | ||
'transient_lastDdlTime'='1407132101') |
Empty file.
21 changes: 21 additions & 0 deletions
21
...hive/src/test/resources/golden/show_create_table_alter-9-2a91d52719cf4552ebeb867204552a26
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,21 @@ | ||
CREATE EXTERNAL TABLE tmp_showcrt1( | ||
key smallint, | ||
value float) | ||
COMMENT 'changed comment' | ||
CLUSTERED BY ( | ||
key) | ||
SORTED BY ( | ||
value DESC) | ||
INTO 5 BUCKETS | ||
ROW FORMAT SERDE | ||
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' | ||
STORED BY | ||
'org.apache.hadoop.hive.ql.metadata.DefaultStorageHandler' | ||
WITH SERDEPROPERTIES ( | ||
'serialization.format'='1') | ||
LOCATION | ||
'file:/tmp/sparkHiveWarehouse1280221975983654134/tmp_showcrt1' | ||
TBLPROPERTIES ( | ||
'last_modified_by'='tianyi', | ||
'last_modified_time'='1407132101', | ||
'transient_lastDdlTime'='1407132101') |
Empty file.
2 changes: 2 additions & 0 deletions
2
...e/src/test/resources/golden/show_create_table_db_table-1-549981e00a3d95f03dd5a9ef6044aa20
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,2 @@ | ||
default | ||
tmp_feng |
Empty file.
Empty file.
13 changes: 13 additions & 0 deletions
13
...e/src/test/resources/golden/show_create_table_db_table-4-b585371b624cbab2616a49f553a870a0
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,13 @@ | ||
CREATE TABLE tmp_feng.tmp_showcrt( | ||
key string, | ||
value int) | ||
ROW FORMAT SERDE | ||
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' | ||
STORED AS INPUTFORMAT | ||
'org.apache.hadoop.mapred.TextInputFormat' | ||
OUTPUTFORMAT | ||
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' | ||
LOCATION | ||
'file:/tmp/sparkHiveWarehouse1280221975983654134/tmp_feng.db/tmp_showcrt' | ||
TBLPROPERTIES ( | ||
'transient_lastDdlTime'='1407132107') |
Empty file.
Empty file.
Empty file.
17 changes: 17 additions & 0 deletions
17
.../src/test/resources/golden/show_create_table_delimited-1-2a91d52719cf4552ebeb867204552a26
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,17 @@ | ||
CREATE TABLE tmp_showcrt1( | ||
key int, | ||
value string, | ||
newvalue bigint) | ||
ROW FORMAT DELIMITED | ||
FIELDS TERMINATED BY ',' | ||
COLLECTION ITEMS TERMINATED BY '|' | ||
MAP KEYS TERMINATED BY '%' | ||
LINES TERMINATED BY '\n' | ||
STORED AS INPUTFORMAT | ||
'org.apache.hadoop.mapred.TextInputFormat' | ||
OUTPUTFORMAT | ||
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' | ||
LOCATION | ||
'file:/tmp/tmp_showcrt1' | ||
TBLPROPERTIES ( | ||
'transient_lastDdlTime'='1407132730') |
Empty file.
Empty file.
16 changes: 16 additions & 0 deletions
16
...rc/test/resources/golden/show_create_table_partitioned-1-2a91d52719cf4552ebeb867204552a26
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,16 @@ | ||
CREATE EXTERNAL TABLE tmp_showcrt1( | ||
key string, | ||
newvalue boolean COMMENT 'a new value') | ||
COMMENT 'temporary table' | ||
PARTITIONED BY ( | ||
value bigint COMMENT 'some value') | ||
ROW FORMAT SERDE | ||
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' | ||
STORED AS INPUTFORMAT | ||
'org.apache.hadoop.mapred.TextInputFormat' | ||
OUTPUTFORMAT | ||
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' | ||
LOCATION | ||
'file:/tmp/sparkHiveWarehouse1280221975983654134/tmp_showcrt1' | ||
TBLPROPERTIES ( | ||
'transient_lastDdlTime'='1407132112') |
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions
15
...hive/src/test/resources/golden/show_create_table_serde-1-2a91d52719cf4552ebeb867204552a26
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,15 @@ | ||
CREATE TABLE tmp_showcrt1( | ||
key int, | ||
value string, | ||
newvalue bigint) | ||
COMMENT 'temporary table' | ||
ROW FORMAT SERDE | ||
'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe' | ||
STORED AS INPUTFORMAT | ||
'org.apache.hadoop.hive.ql.io.RCFileInputFormat' | ||
OUTPUTFORMAT | ||
'org.apache.hadoop.hive.ql.io.RCFileOutputFormat' | ||
LOCATION | ||
'file:/tmp/sparkHiveWarehouse1280221975983654134/tmp_showcrt1' | ||
TBLPROPERTIES ( | ||
'transient_lastDdlTime'='1407132115') |
Empty file.
Empty file.
14 changes: 14 additions & 0 deletions
14
...hive/src/test/resources/golden/show_create_table_serde-4-2a91d52719cf4552ebeb867204552a26
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,14 @@ | ||
CREATE EXTERNAL TABLE tmp_showcrt1( | ||
key string, | ||
value boolean) | ||
ROW FORMAT SERDE | ||
'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe' | ||
STORED BY | ||
'org.apache.hadoop.hive.ql.metadata.DefaultStorageHandler' | ||
WITH SERDEPROPERTIES ( | ||
'serialization.format'='$', | ||
'field.delim'=',') | ||
LOCATION | ||
'file:/tmp/sparkHiveWarehouse1280221975983654134/tmp_showcrt1' | ||
TBLPROPERTIES ( | ||
'transient_lastDdlTime'='1407132115') |
Empty file.
Empty file.
1 change: 1 addition & 0 deletions
1
sql/hive/src/test/resources/golden/show_create_table_view-1-1e931ea3fa6065107859ffbb29bb0ed7
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 @@ | ||
CREATE VIEW tmp_copy_src AS SELECT `src`.`key`, `src`.`value` FROM `default`.`src` |
Empty file.
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