[ 
https://issues.apache.org/jira/browse/HIVE-25652?focusedWorklogId=690387&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-690387
 ]

ASF GitHub Bot logged work on HIVE-25652:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Dec/21 23:40
            Start Date: 03/Dec/21 23:40
    Worklog Time Spent: 10m 
      Work Description: soumyakanti3578 commented on a change in pull request 
#2777:
URL: https://github.com/apache/hive/pull/2777#discussion_r762345916



##########
File path: ql/src/test/results/clientpositive/llap/show_create_table.q.out
##########
@@ -0,0 +1,161 @@
+PREHOOK: query: 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 CHECK (col3 + col4 > 1) enable novalidate rely,
+  col4 decimal NOT NULL,
+  col5 varchar(100),
+  primary key(col1, col2) disable novalidate rely,
+  constraint c3_c4_check CHECK((col3 + col4)/(col3 - col4) > 3),
+  constraint c4_unique UNIQUE(col4) disable novalidate rely)
+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'
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@TEST
+POSTHOOK: query: 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 CHECK (col3 + col4 > 1) enable novalidate rely,
+  col4 decimal NOT NULL,
+  col5 varchar(100),
+  primary key(col1, col2) disable novalidate rely,
+  constraint c3_c4_check CHECK((col3 + col4)/(col3 - col4) > 3),
+  constraint c4_unique UNIQUE(col4) disable novalidate rely)
+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'
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@TEST
+PREHOOK: query: CREATE TABLE TEST2(
+ col varchar(100),
+ primary key(col) disable novalidate rely)
+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'
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@TEST2
+POSTHOOK: query: CREATE TABLE TEST2(
+ col varchar(100),
+ primary key(col) disable novalidate rely)
+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'
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@TEST2
+PREHOOK: query: CREATE TABLE TEST3(
+  col1 varchar(100) COMMENT "comment",
+  col2 timestamp,
+  col3 varchar(100),
+  foreign key(col1, col2) references TEST(col1, col2) disable novalidate rely,
+  foreign key(col3) references TEST2(col) disable novalidate rely)
+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'
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@TEST3
+POSTHOOK: query: CREATE TABLE TEST3(
+  col1 varchar(100) COMMENT "comment",
+  col2 timestamp,
+  col3 varchar(100),
+  foreign key(col1, col2) references TEST(col1, col2) disable novalidate rely,
+  foreign key(col3) references TEST2(col) disable novalidate rely)
+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'
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@TEST3
+PREHOOK: query: SHOW CREATE TABLE TEST
+PREHOOK: type: SHOW_CREATETABLE
+PREHOOK: Input: default@test
+POSTHOOK: query: SHOW CREATE TABLE TEST
+POSTHOOK: type: SHOW_CREATETABLE
+POSTHOOK: Input: default@test
+CREATE TABLE `test`(
+  `col1` varchar(100) COMMENT 'comment for column 1', 
+  `col2` timestamp COMMENT 'comment for column 2', 
+  `col3` decimal(10,0), 
+  `col4` decimal(10,0), 
+  `col5` varchar(100))
+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'
+LOCATION
+#### A masked pattern was here ####
+TBLPROPERTIES (
+  'bucketing_version'='2', 
+#### A masked pattern was here ####
+ALTER TABLE default.test ADD CONSTRAINT #### A masked pattern was here #### 
PRIMARY KEY (col1,col2) DISABLE NOVALIDATE RELY;
+ALTER TABLE default.test ADD CONSTRAINT c4_unique UNIQUE (col4) DISABLE 
NOVALIDATE RELY;
+ALTER TABLE test.test CHANGE COLUMN col2 col2 timestamp CONSTRAINT  DEFAULT 
CURRENT_TIMESTAMP() ENABLE NOVALIDATE RELY;
+ALTER TABLE default.test ADD CONSTRAINT c3_c4_check CHECK ((col3 + col4)/(col3 
- col4) > 3) ENABLE NOVALIDATE RELY;
+ALTER TABLE default.test ADD CONSTRAINT #### A masked pattern was here #### 
CHECK (col3 + col4 > 1) ENABLE NOVALIDATE RELY;
+ALTER TABLE default.test CHANGE COLUMN col1 col1 varchar(100) CONSTRAINT #### 
A masked pattern was here #### NOT NULL ENABLE NOVALIDATE RELY;

Review comment:
       I confirmed by debugging that the masked pattern is indeed the auto 
generated constraint name.I checked 
[here](https://github.com/apache/hive/blob/master/itests/util/src/main/java/org/apache/hadoop/hive/ql/QOutProcessor.java#L213)
 that the value of `line` was
    `ALTER TABLE default.test ADD CONSTRAINT pk_32642683_1638573914471_0 
PRIMARY KEY (col1,col2) DISABLE NOVALIDATE RELY;` 
   and the value after processing the line is 
   `ALTER TABLE default.test ADD CONSTRAINT #### A masked pattern was here #### 
PRIMARY KEY (col1,col2) DISABLE NOVALIDATE RELY;`.




-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 690387)
    Time Spent: 5.5h  (was: 5h 20m)

> Add constraints in result of “SHOW CREATE TABLE ”
> -------------------------------------------------
>
>                 Key: HIVE-25652
>                 URL: https://issues.apache.org/jira/browse/HIVE-25652
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Soumyakanti Das
>            Assignee: Soumyakanti Das
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 5.5h
>  Remaining Estimate: 0h
>
> Currently show create table doesn’t pull any constraint info like not null, 
> defaults, primary key.
> 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 {{SHOW CREATE TABLE TEST}} doesn't show the column constraints.
> {code:java}
> CREATE TABLE `test`(
>   `col1` varchar(100) COMMENT 'comment for column 1', 
>   `col2` timestamp COMMENT 'comment for column 2', 
>   `col3` decimal(10,0), 
>   `col4` varchar(512), 
>   `col5` varchar(100))
> 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}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to