GitHub user gatorsmile opened a pull request:

    https://github.com/apache/spark/pull/13070

    [SPARK-15286] [SQL] Make the output readable for EXPLAIN CREATE TABLE and 
DESC EXTENDED

    #### What changes were proposed in this pull request?
    Before this PR, the output of EXPLAIN of following SQL is like
    
    ```SQL
    CREATE EXTERNAL TABLE extTable_with_partitions (key INT, value STRING)
    PARTITIONED BY (ds STRING, hr STRING)
    LOCATION 
'/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-b39a6185-8981-403b-a4aa-36fb2f4ca8a9'
    ```
    `ExecutedCommand CreateTable 
CatalogTable(``extTable_with_partitions``,CatalogTableType(EXTERNAL),CatalogStorageFormat(Some(/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-dd234718-e85d-4c5a-8353-8f1834ac0323),Some(org.apache.hadoop.mapred.TextInputFormat),Some(org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat),None,false,Map()),List(CatalogColumn(key,int,true,None),
 CatalogColumn(value,string,true,None), CatalogColumn(ds,string,true,None), 
CatalogColumn(hr,string,true,None)),List(ds, 
hr),List(),List(),-1,,1463026413544,-1,Map(),None,None,None), false`
    
    After this PR, the output is like
    
    `ExecutedCommand CreateTable CatalogTable(Table:extTable_with_partitions, 
Database:null, Owner:, Create Time:Wed May 11 21:05:06 PDT 2016, Last Access 
Time:Wed Dec 31 15:59:59 PST 1969, 
Location:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-d5d9cbc4-5c20-4c52-b2a7-84c03ca6bc7d,
 Table Type:EXTERNAL, Schema:[Column(name:key, dataType:int, nullable:Yes, 
comment:null), Column(name:value, dataType:string, nullable:Yes, comment:null), 
Column(name:ds, dataType:string, nullable:Yes, comment:null), Column(name:hr, 
dataType:string, nullable:Yes, comment:null)], Partition Columns:[ds, hr], Num 
Buckets:-1, Bucket Columns:[], Sort Columns:[], View Original Text:null, View 
Text:null, Comment:null, Table Parameters:[], Storage 
Information(Location:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-d5d9cbc4-5c20-4c52-b2a7-84c03ca6bc7d,
 InputFormat:org.apache.hadoop.mapred.TextInputFormat, 
OutputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, Compre
 ssed:No, Storage Desc Library:null, Storage Desc Parameter:[])), false`
    
    This is also applicable to DESC EXTENDED. However, this does not have 
special handling for Data Source Tables. If needed, we need to move the logics 
of `DDLUtil`. Let me know if we should do it in this PR. Thanks! @rxin 
@liancheng 
    
    #### How was this patch tested?
    Manual testing

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gatorsmile/spark betterExplainCatalogTable

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/13070.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 #13070
    
----
commit 5f83dbd440de9c7a0a8a0c014f1feadd1ebceed7
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2016-05-12T04:09:27Z

    improve the explain and desc extended.

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to