[
https://issues.apache.org/jira/browse/HIVE-25566?focusedWorklogId=685821&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-685821
]
ASF GitHub Bot logged work on HIVE-25566:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 24/Nov/21 13:18
Start Date: 24/Nov/21 13:18
Worklog Time Spent: 10m
Work Description: kgyrtkirk commented on a change in pull request #2678:
URL: https://github.com/apache/hive/pull/2678#discussion_r756064798
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/info/desc/formatter/TextDescTableFormatter.java
##########
@@ -129,7 +168,7 @@ private void addPartitionTransformData(DataOutputStream
out, Table table, boolea
out.write(partitionTransformOutput.getBytes(StandardCharsets.UTF_8));
}
- private void addStatsData(DataOutputStream out, String columnPath,
List<FieldSchema> columns, boolean isFormatted,
+ private void addStatsData(DataOutputStream out, String columnPath, Table
table, List<FieldSchema> columns, boolean isFormatted,
Review comment:
I think it would possibly be beneficial to put the constraint info into
the `FieldSchema` itself in some usable way ...not sure what would be the
earliest point we could set it but it could make constraint info more
accessible...
maybe return with a non-thrift `FieldSchema` from the `Table` which is
constriant aware?
we are always making circles because data is not where it supposed to be...
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/ShowUtils.java
##########
@@ -132,11 +132,11 @@ public static void appendNonNull(StringBuilder builder,
Object value, boolean fi
}
- public static String[] extractColumnValues(FieldSchema column, boolean
isColumnStatsAvailable,
+ public static String[] extractColumnValues(FieldSchema column, String
colConstraint, boolean isColumnStatsAvailable,
Review comment:
can we keep a method with the old signature as well?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 685821)
Time Spent: 40m (was: 0.5h)
> 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: 40m
> 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.20.1#820001)