sankarh commented on a change in pull request #388: HIVE-20057: Fix Hive table
conversion DESCRIBE table bug
URL: https://github.com/apache/hive/pull/388#discussion_r264106935
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -1802,12 +1802,12 @@ private MTable convertToMTable(Table tbl) throws
InvalidObjectException,
// accordingly
String tableType = tbl.getTableType();
boolean isExternal =
Boolean.parseBoolean(tbl.getParameters().get("EXTERNAL"));
- if (TableType.MANAGED_TABLE.toString().equals(tableType)) {
+ if (TableType.MANAGED_TABLE.toString().equalsIgnoreCase(tableType)) {
Review comment:
@animenon
Thanks for thr reply! But, I'm still confused.
As per your point, isExternal is proper (both "True" and "TRUE"). But, why
would tableType have different case based on input for EXTERNAL property?
Below is the code that reads EXTERNAL property from ALTER TABLE command and
sets correct tableType.
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java#L4092
```
String externalProp = alterTbl.getProps().get("EXTERNAL");
if (externalProp != null) {
if (Boolean.parseBoolean(externalProp) && tbl.getTableType() ==
TableType.MANAGED_TABLE) {
tbl.setTableType(TableType.EXTERNAL_TABLE);
} else if (!Boolean.parseBoolean(externalProp) && tbl.getTableType()
== TableType.EXTERNAL_TABLE) {
tbl.setTableType(TableType.MANAGED_TABLE);
}
}
```
If you notice, we use Boolean.parseBoolean(externalProp) here which ignores
case.
I didn't get how two values of externalProp ("True" and "TRUE") influences
the table type set via setTableType.
Pls point to what I'm missing here.
@rmsmani
Please check if I miss anything.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services