[ https://issues.apache.org/jira/browse/HIVE-25652?focusedWorklogId=687696&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-687696 ]
ASF GitHub Bot logged work on HIVE-25652: ----------------------------------------- Author: ASF GitHub Bot Created on: 30/Nov/21 00:17 Start Date: 30/Nov/21 00:17 Worklog Time Spent: 10m Work Description: soumyakanti3578 commented on pull request #2777: URL: https://github.com/apache/hive/pull/2777#issuecomment-982153696 @kasakrisz I tried adding a primary key constraint to the suggested table in`quotedid_basic.q`, however, I am getting an error: ` org.apache.hadoop.hive.ql.metadata.HiveException: InvalidObjectException(message:Parent column not found: "%&'()*+,-/;<=>?[]_|{}$^!~#@``) at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:1298) at org.apache.hadoop.hive.ql.ddl.table.create.CreateTableOperation.createTableNonReplaceMode(CreateTableOperation.java:136) at org.apache.hadoop.hive.ql.ddl.table.create.CreateTableOperation.execute(CreateTableOperation.java:98) at org.apache.hadoop.hive.ql.ddl.DDLTask.execute(DDLTask.java:84) at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:212) at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:105) at org.apache.hadoop.hive.ql.Executor.launchTask(Executor.java:361) at org.apache.hadoop.hive.ql.Executor.launchTasks(Executor.java:334) at org.apache.hadoop.hive.ql.Executor.runTasks(Executor.java:245) at org.apache.hadoop.hive.ql.Executor.execute(Executor.java:108) at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:348) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:204) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:153) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:148) at org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:164) at org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:230) at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:256) at org.apache.hadoop.hive.cli.CliDriver.processCmd1(CliDriver.java:201) at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:127) at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:422) at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:353) at org.apache.hadoop.hive.ql.QTestUtil.executeClientInternal(QTestUtil.java:726) at org.apache.hadoop.hive.ql.QTestUtil.executeClient(QTestUtil.java:696) at org.apache.hadoop.hive.cli.control.CoreCliDriver.runTest(CoreCliDriver.java:114) at org.apache.hadoop.hive.cli.control.CliAdapter.runTest(CliAdapter.java:157) at org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver(TestMiniLlapLocalCliDriver.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)` This error is due to mismatch of the column names. In the `addPrimaryKey` method [here](https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L5724), `columnName` gets trimmed in `normalizeIdentifier` and loses the ` `(space), and it doesn't match with the column name from the ColumnDescriptor in `getColumnIndexFromTableColumns` method [here](https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L5735). And this happens because we don't call `normalizeIdentifier` on the column name while converting `FieldSchema` to `MFieldSchema` in `convertToMFieldSchemas` method [here](https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L2297) . I tried adding `normalizeIdentifier` there but it fails elsewhere, and anyway I don't think its the correct solution because we don't want to trim the quoted identifier. What do you think about this? -- 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: 687696) Time Spent: 3.5h (was: 3h 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: 3.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)