GitHub user liancheng opened a pull request:
https://github.com/apache/spark/pull/12844
[SPARK-14127][SQL] Native "DESC [EXTENDED | FORMATTED] <table>" DDL command
## What changes were proposed in this pull request?
This PR implements native `DESC [EXTENDED | FORMATTED] <table>` DDL
command. Sample output:
```
scala> spark.sql("desc extended src").show(100, truncate = false)
+----------------------------+---------------------------------+-------+
|col_name |data_type |comment|
+----------------------------+---------------------------------+-------+
|key |int | |
|value |string | |
| | | |
|# Detailed Table Information|CatalogTable(`default`.`src`, ...| |
+----------------------------+---------------------------------+-------+
scala> spark.sql("desc formatted src").show(100, truncate = false)
+----------------------------+----------------------------------------------------------+-------+
|col_name |data_type
|comment|
+----------------------------+----------------------------------------------------------+-------+
|key |int
| |
|value |string
| |
| |
| |
|# Detailed Table Information|
| |
|Database: |default
| |
|Owner: |lian
| |
|Create Time: |Mon Jan 04 17:06:00 CST 2016
| |
|Last Access Time: |Thu Jan 01 08:00:00 CST 1970
| |
|Location:
|hdfs://localhost:9000/user/hive/warehouse_hive121/src | |
|Table Type: |MANAGED
| |
|Table Parameters: |
| |
| transient_lastDdlTime |1451898360
| |
| |
| |
|# Storage Information |
| |
|SerDe Library:
|org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | |
|InputFormat: |org.apache.hadoop.mapred.TextInputFormat
| |
|OutputFormat:
|org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat| |
|Num Buckets: |-1
| |
|Bucket Columns: |[]
| |
|Sort Columns: |[]
| |
|Storage Desc Parameters: |
| |
| serialization.format |1
| |
+----------------------------+----------------------------------------------------------+-------+
```
## How was this patch tested?
A test case is added to `HiveDDLSuite` to check command output.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/liancheng/spark spark-14127-desc-table
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/12844.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #12844
----
commit 89e0aea04bdeffaa69be0c19f10860d12af90953
Author: Cheng Lian <[email protected]>
Date: 2016-05-02T17:07:32Z
Implements native 'DESC TABE' DDL command
commit 718da25b489ef56e2b1092484bd6fbcdf2a547ed
Author: Cheng Lian <[email protected]>
Date: 2016-05-02T17:39:24Z
Test case
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]