[ 
https://issues.apache.org/jira/browse/HIVE-558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901649#action_12901649
 ] 

Namit Jain commented on HIVE-558:
---------------------------------

What I was thinking was like this:


Change:

  public String getSchema() {
    return schema;
  }


in DescTableDesc.java to a static funtion:

  public static String getSchema() {
    return schema;
  }





    public static String getAllColumnsInformation(Table tbl) {
        StringBuilder columnInformation = new StringBuilder(1024);
        formatOutput("Column", "Type", "Comments", columnInformation);
        formatOutput("------", "----", "--------", columnInformation);
        getColumnInfoAsString(columnInformation, tbl);

        // Partitions
        if (tbl.isPartitioned()) {
            columnInformation.append(LINE_DELIM);
            formatOutput("Partition", "Type", "Comments", columnInformation);
            formatOutput("---------", "----", "--------", columnInformation);
            getPartitionInfoAsString(columnInformation, tbl);
        }
        return columnInformation.toString();
    }



can be::



    public static String getAllColumnsInformation(Table tbl) {
        StringBuilder columnInformation = new StringBuilder(1024);
        String schema = DescTableDesc.getSchema();
        String[] colsArr = parseTheSchemaToGetListOfCols(); // it should return 
["col_name","data_type","comment"]
        formatOutput(colsArr, columnInformation);   // takes in array as an 
input
        getColumnInfoAsString(columnInformation, tbl);

        // Partitions
        if (tbl.isPartitioned()) {
            columnInformation.append(LINE_DELIM);
// same as above

            formatOutput("Partition", "Type", "Comments", columnInformation);
            formatOutput("---------", "----", "--------", columnInformation);




// If you want to show partitioned columns, have a seperate line: something 
like:
PARTITIONED COLUMNS

after the initial columns

            getPartitionInfoAsString(columnInformation, tbl);
        }
        return columnInformation.toString();
    }




It is pretty close to what you have - only the schema is defined in one place. 
What do you think ?

> describe extended table/partition output is cryptic
> ---------------------------------------------------
>
>                 Key: HIVE-558
>                 URL: https://issues.apache.org/jira/browse/HIVE-558
>             Project: Hadoop Hive
>          Issue Type: Improvement
>          Components: Metastore
>            Reporter: Prasad Chakka
>         Attachments: HIVE-558_PrelimPatch.patch, SampleOutputDescribe.txt
>
>
> describe extended table prints out the Thrift metadata object directly. The 
> information from it is not easy to read or parse. Output should be easily 
> read and can be simple parsed to get table location etc by programs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to