[
https://issues.apache.org/jira/browse/HIVE-25566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17421574#comment-17421574
]
Soumyakanti Das commented on HIVE-25566:
----------------------------------------
Done!
> Show column constraints for "DESC FORMATTED TABLE"
> --------------------------------------------------
>
> Key: HIVE-25566
> URL: https://issues.apache.org/jira/browse/HIVE-25566
> Project: Hive
> Issue Type: New Feature
> Reporter: Soumyakanti Das
> Assignee: Soumyakanti Das
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Currently, column constraints are not shown with the data type of columns.
> They are shown all together at the end, but showing them with the data type
> will make the description more readable.
>
> Example:
> Create table
>
> {code:java}
> CREATE TABLE TEST(
> col1 varchar(100) NOT NULL COMMENT "comment for column 1",
> col2 timestamp DEFAULT CURRENT_TIMESTAMP() COMMENT "comment for column 2",
> col3 decimal,
> col4 varchar(512) NOT NULL,
> col5 varchar(100),
> primary key(col1, col2) disable novalidate)
> ROW FORMAT SERDE
> 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
> STORED AS INPUTFORMAT
> 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
> OUTPUTFORMAT
> 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';
> {code}
>
> Currently, {{DESC FORMATTED TABLE }} returns,
> {code:java}
> # col_name data_type comment
> col1 varchar(100) comment for column 1
> col2 timestamp comment for column 2
> col3 decimal(10,0)
> col4 varchar(512)
> col5 varchar(100)
> # Detailed Table Information
> Database: default
> #### A masked pattern was here ####
> Retention: 0
> #### A masked pattern was here ####
> Table Type: MANAGED_TABLE
> Table Parameters:
> COLUMN_STATS_ACCURATE
> {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"col1\":\"true\",\"col2\":\"true\",\"col3\":\"true\",\"col4\":\"true\",\"col5\":\"true\"}}
> bucketing_version 2
> numFiles 0
> numRows 0
> rawDataSize 0
> totalSize 0
> #### A masked pattern was here ####
> # Storage Information
> SerDe Library: org.apache.hadoop.hive.ql.io.orc.OrcSerde
> InputFormat: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
> OutputFormat: org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat
>
> Compressed: No
> Num Buckets: -1
> Bucket Columns: []
> Sort Columns: []
> Storage Desc Params:
> serialization.format 1
> # Constraints
> # Primary Key
> Table: default.test
> Constraint Name: #### A masked pattern was here ####
> Column Name: col1
> Column Name: col2
> # Not Null Constraints
> Table: default.test
> Constraint Name: #### A masked pattern was here ####
> Column Name: col1
> Constraint Name: #### A masked pattern was here ####
> Column Name: col4
> # Default Constraints
> Table: default.test
> Constraint Name: #### A masked pattern was here ####
> Column Name:col2 Default Value:CURRENT_TIMESTAMP()
> {code}
>
> Adding the column constraints will look something like,
> {code:java}
> # col_name data_type
> comment
> col1 varchar(100) PRIMARY KEY NOT NULL
> comment for column 1
> col2 timestamp PRIMARY KEY DEFAULT CURRENT_TIMESTAMP()
> comment for column 2
> col3 decimal(10,0)
> col4 varchar(512) NOT NULL
> col5 varchar(100)
> # Detailed Table Information
> Database: default
> #### A masked pattern was here ####
> Retention: 0
> #### A masked pattern was here ####
> Table Type: MANAGED_TABLE
> Table Parameters:
> COLUMN_STATS_ACCURATE
> {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"col1\":\"true\",\"col2\":\"true\",\"col3\":\"true\",\"col4\":\"true\",\"col5\":\"true\"}}
> bucketing_version 2
> numFiles 0
> numRows 0
> rawDataSize 0
> totalSize 0
> #### A masked pattern was here ####
> # Storage Information
> SerDe Library: org.apache.hadoop.hive.ql.io.orc.OrcSerde
> InputFormat: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
> OutputFormat: org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat
>
> Compressed: No
> Num Buckets: -1
> Bucket Columns: []
> Sort Columns: []
> Storage Desc Params:
> serialization.format 1
> # Constraints
> # Primary Key
> Table: default.test
> Constraint Name: #### A masked pattern was here ####
> Column Name: col1
> Column Name: col2
> # Not Null Constraints
> Table: default.test
> Constraint Name: #### A masked pattern was here ####
> Column Name: col1
> Constraint Name: #### A masked pattern was here ####
> Column Name: col4
> # Default Constraints
> Table: default.test
> Constraint Name: #### A masked pattern was here ####
> Column Name:col2 Default Value:CURRENT_TIMESTAMP()
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)