Login  Register

Re: Change the 'comment' content for column when execute command 'desc formatted table_name'

Posted by Liang Chen on Apr 26, 2018; 2:43am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/Change-the-comment-content-for-column-when-execute-command-desc-formatted-table-name-tp46848p46870.html

Hi

Thank you started the discussion.

Propose to completely optimize this part, my suggestion as below :

CREATE TABLE IF NOT EXISTS test_table (
    id INT COMMENT 'device id for sensor XYZ',
    name STRING,
    salary LONG,
    tax DOUBLE
    )
PARTITIONED BY (city STRING)
STORED BY 'carbondata'
TBLPROPERTIES('SORT_COLUMNS'='name,id','NO_INVERTED_INDEX'='id','DICTIONARY_INCLUDE'='name')

## Table Schema Information
|col_name  |data_type     |comment                                     |
+----------+--------------+--------------------------------------------+
|id        |int           |device id for sensor XYZ      
|name      |string        |                
|city      |string        |    
|salary    |bigint        |
|tax       |double        |    

## Table Basic Information
|Database Name                       |default                                                                        
|                                                                        |
|Table Name                          |test_table                                                                    
|                                                                        |
|CARBON Store Path                   |/Users/apple/DEMO/presto_test/data                                            
|                                                                        |
|Comment                             |                                                                              
|                                                                        |                                                                    
|                                                                        |
|Table Data Size                     |0                                                                              
|                                                                        |
|Table Index Size                    |0                                                                              
|                                                                        |
|Last Update Time                    |0    
       
## Detailed Table Properties Information
|SORT_COLUMNS             |name,id
|NO_INVERTED_INDEX        |id
|DICTIONARY_INCLUDE       |name
|TABLE_BLOCKSIZE          |1024 MB
|SORT_SCOPE               |LOCAL_SORT
|STREAMING                |false

## Detailed Partition Information
|PARTITION_COLUMNS        |city

## Location Path

## As Select_statement


Regards
Liang


xm_zzc wrote

> Hi dev:
>   Currently the 'comment' content for column is ambiguous and unclear when
> execute command 'desc formatted table_name', for example:
>   ran create table sql:
>   CREATE TABLE IF NOT EXISTS test_table (
>     id INT,
>     name STRING,
>     city STRING,
>     salary LONG,
>     tax DOUBLE
>     )
>     STORED BY 'carbondata'
>     TBLPROPERTIES(
>     'streaming'='false', 'sort_columns'='name,id',
> 'dictionary_include'='name');
>    
>   and then ran 'desc formatted test_table', it showed the content below:
>   |col_name  |data_type     |comment                                     |
>   +----------+--------------+--------------------------------------------+
>   |id            |int                |
*
> KEY COLUMN,NOINVERTEDINDEX
*
> ,null             |
>   |name      |string            |DICTIONARY,
*
> KEY COLUMN
*
> ,null                 |
>   |city         |string            |
*
> KEY COLUMN
*

> ,null                             |
>   |salary     |bigint             |MEASURE,null                              
> |
>   |tax         |double            |MEASURE,null                              
> |
>   |          |              |                                            |
>  
>   1. what's the 'KEY COLUMN' mean? all document do not describe this
> concept, just introduce dimension column, measure column, inverted index,
> dictionary column and so on.
>   2. Actually 'city' field is just a dimension column and does not have
> inverted index, but 'id', 'name' and 'city' field are shown as 'KEY
> COLUMN',
> how to distinguish between them?
>  
>   So IMO, We can show more detailed information on 'comment' column and
> remove 'KEY COLUMN' description, for example:
>   run 'desc formatted test_table', it can show the content below:
>   |col_name  |data_type     |comment                                     |
>   +----------+--------------+--------------------------------------------+
>   |id            |int               |
*
> DIMENSION,NOINVERTEDINDEX
*
> ,null              |
>   |name      |string           |
*
> DIMENSION,DICTIONARY,INVERTEDINDEX
*
> ,null     |
>   |city         |string           |
*
> DIMENSION
*

> ,null                              |
>   |salary     |bigint            |MEASURE,null                              
> |
>   |tax         |double           |MEASURE,null                              
> |
>   |          |              |                                            |
>  
>   How about this change? Any suggestion for this? Please let me know.
>
>
>
>
> --
> Sent from:
> http://apache-carbondata-dev-mailing-list-archive.1130556.n5.nabble.com/





--
Sent from: http://apache-carbondata-dev-mailing-list-archive.1130556.n5.nabble.com/