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

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

                Author: ASF GitHub Bot
            Created on: 21/May/21 15:01
            Start Date: 21/May/21 15:01
    Worklog Time Spent: 10m 
      Work Description: nrg4878 commented on a change in pull request #2191:
URL: https://github.com/apache/hive/pull/2191#discussion_r636924592



##########
File path: ql/src/test/results/clientnegative/translated_external_rename.q.out
##########
@@ -0,0 +1,22 @@
+PREHOOK: query: create external table t (a integer)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@t
+POSTHOOK: query: create external table t (a integer)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@t
+PREHOOK: query: insert into t values(1)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@t
+POSTHOOK: query: insert into t values(1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@t
+POSTHOOK: Lineage: t.a SCRIPT []
+PREHOOK: query: alter table t rename to t2
+PREHOOK: type: ALTERTABLE_RENAME
+PREHOOK: Input: default@t
+PREHOOK: Output: default@t
+FAILED: Execution Error, return code 40013 from 
org.apache.hadoop.hive.ql.ddl.DDLTask. Unable to alter table. 
java.lang.NullPointerException

Review comment:
       nit: Looks like the exception is NullPointerException. Not a showstopper 
but I would expect this to be a MetaException

##########
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:
       So we only care that an external table is outside the managed warehouse 
root. It does not have to be within the external warehouse. So even if external 
warehouse isnt set, we shouldnt have to reject a path so long as it is not in 
the managed warehouse root.




-- 
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: 600407)
    Time Spent: 50m  (was: 40m)

> TRANSLATED_TO_EXTERNAL tables may write to the same location
> ------------------------------------------------------------
>
>                 Key: HIVE-24920
>                 URL: https://issues.apache.org/jira/browse/HIVE-24920
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> {code}
> create table t (a integer);
> insert into t values(1);
> alter table t rename to t2;
> create table t (a integer); -- I expected an exception from this command 
> (location already exists) but because its an external table no exception
> insert into t values(2);
> select * from t;  -- shows 1 and 2
> drop table t2;    -- wipes out data location
> select * from t;  -- empty resultset
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to