kgyrtkirk commented on a change in pull request #2191:
URL: https://github.com/apache/hive/pull/2191#discussion_r637024947



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetastoreDefaultTransformer.java
##########
@@ -822,7 +934,7 @@ private Table validateTablePaths(Table table) throws 
MetaException {
                     + table.getTableName() + ",location:" + tablePath + 
",Database's managed warehouse:" + dbLocation);
           }
         } else {
-          if (FileUtils.isSubdirectory(whRootPath.toString(), 
tablePath.toString())) {
+          if (isExternalWarehouseSet() && 
FileUtils.isSubdirectory(whRootPath.toString(), tablePath.toString())) {

Review comment:
       I just bumped into this while fixing this issue - in case the  
`externalWarehouse`  is not set both external and managed tables are placed at 
the same location with the default configs:
   ```
   create external table te (a integer); // file:/data/hive/warehouse/t
   desc formatted te;
   [...]
   | Location:                     | file:/data/hive/warehouse/te               
        | NULL                                               |
   | Table Parameters:             | NULL                                       
        | NULL                                               |
   |                               | EXTERNAL                                   
        | TRUE                                               |
   
   [...]
   create  table tm (a integer);
   desc formatted tm;
   [...]
   | Location:                     | file:/data/hive/warehouse/tm               
        | NULL                                               |
   | Table Type:                   | EXTERNAL_TABLE                             
        | NULL                                               |
   |                               | EXTERNAL                                   
        | TRUE                                               |
   |                               | TRANSLATED_TO_EXTERNAL                     
        | TRUE                                               |
   [...]
   ```
   
   the root cause of this is that
   * in case the ext wh is not set - it will be the default whroot:
   
https://github.com/apache/hive/blob/bf608ceadaf571440b0ead079adab674400fc956/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/Warehouse.java#L209
   * managed location for both default and non-default dbs are under wh by 
default
   
   since the managed location is the same I don't think checking that would 
make sense...
   
   don't you think that the current change aligns with the existing 
decisions/behaiour/etc in the above case?




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to