[ https://issues.apache.org/jira/browse/HIVE-19253?focusedWorklogId=516771&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-516771 ]
ASF GitHub Bot logged work on HIVE-19253: ----------------------------------------- Author: ASF GitHub Bot Created on: 25/Nov/20 16:57 Start Date: 25/Nov/20 16:57 Worklog Time Spent: 10m Work Description: szehon-ho edited a comment on pull request #1537: URL: https://github.com/apache/hive/pull/1537#issuecomment-733051181 Sorry I've been awhile. Thanks Naveen for taking a look. I had some free time today to take a look at the TestHiveMetstoreTransformer but am still a bit lost. I tried to set the table type to ManagedTable as you suggest, but the MetastoreDefaultTransformer actually transforms it back to External table by the time the assert happens (actually this should probably do it not via the properties but by the modeled TableType, but in this case it doesn't matter). Code: https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetastoreDefaultTransformer.java#L596. So then after that , it run the asserts which fail as they seem to be testing for ManagedTable, unless I am mistaken. If you have some time to let me know anything else to try, would appreciate it. I haven't taken a look at Miguel's comments yet. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 516771) Time Spent: 2h 10m (was: 2h) > HMS ignores tableType property for external tables > -------------------------------------------------- > > Key: HIVE-19253 > URL: https://issues.apache.org/jira/browse/HIVE-19253 > Project: Hive > Issue Type: Bug > Components: Metastore > Affects Versions: 3.1.0, 3.0.0, 4.0.0 > Reporter: Alex Kolbasov > Assignee: Vihang Karajgaonkar > Priority: Major > Labels: newbie, pull-request-available > Attachments: HIVE-19253.01.patch, HIVE-19253.02.patch, > HIVE-19253.03.patch, HIVE-19253.03.patch, HIVE-19253.04.patch, > HIVE-19253.05.patch, HIVE-19253.06.patch, HIVE-19253.07.patch, > HIVE-19253.08.patch, HIVE-19253.09.patch, HIVE-19253.10.patch, > HIVE-19253.11.patch, HIVE-19253.12.patch > > Time Spent: 2h 10m > Remaining Estimate: 0h > > When someone creates a table using Thrift API they may think that setting > tableType to {{EXTERNAL_TABLE}} creates an external table. And boom - their > table is gone later because HMS will silently change it to managed table. > here is the offending code: > {code:java} > private MTable convertToMTable(Table tbl) throws InvalidObjectException, > MetaException { > ... > // If the table has property EXTERNAL set, update table type > // accordingly > String tableType = tbl.getTableType(); > boolean isExternal = > Boolean.parseBoolean(tbl.getParameters().get("EXTERNAL")); > if (TableType.MANAGED_TABLE.toString().equals(tableType)) { > if (isExternal) { > tableType = TableType.EXTERNAL_TABLE.toString(); > } > } > if (TableType.EXTERNAL_TABLE.toString().equals(tableType)) { > if (!isExternal) { // Here! > tableType = TableType.MANAGED_TABLE.toString(); > } > } > {code} > So if the EXTERNAL parameter is not set, table type is changed to managed > even if it was external in the first place - which is wrong. > More over, in other places code looks at the table property to decide table > type and some places look at parameter. HMS should really make its mind which > one to use. -- This message was sent by Atlassian Jira (v8.3.4#803005)