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

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

                Author: ASF GitHub Bot
            Created on: 09/Jan/23 12:45
            Start Date: 09/Jan/23 12:45
    Worklog Time Spent: 10m 
      Work Description: dengzhhu653 commented on code in PR #3920:
URL: https://github.com/apache/hive/pull/3920#discussion_r1064601531


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java:
##########
@@ -270,8 +270,12 @@ public void alterTable(RawStore msdb, Warehouse wh, String 
catName, String dbnam
 
             // get new location
             assert(isReplicated == HMSHandler.isDbReplicationTarget(db));
-            if (renamedTranslatedToExternalTable) {
+            if (renamedTranslatedToExternalTable && !tableInSpecifiedLoc) {
               destPath = new Path(newt.getSd().getLocation());

Review Comment:
   nit: we can build the `destPath` under `if 
(renamedTranslatedToExternalTablc)`:
   ```java
   if (renamedTranslatedToExternalTablc) {
      if (tableInSpecifiedLoc) {
        ....
      } else {
       ...
      }
   }





Issue Time Tracking
-------------------

    Worklog Id:     (was: 837927)
    Time Spent: 40m  (was: 0.5h)

> Renaming a translated external table with a specified location fails with 
> 'location already exists' exception
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-26911
>                 URL: https://issues.apache.org/jira/browse/HIVE-26911
>             Project: Hive
>          Issue Type: Bug
>          Components: Standalone Metastore
>    Affects Versions: 4.0.0
>            Reporter: Sai Hemanth Gantasala
>            Assignee: Sai Hemanth Gantasala
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Renaming a translated external table with a specified location fails with 
> 'location already exists' exception.
> Below are steps for repro
> {code:java}
> create database tmp;
> use tmp;
> create table b(s string) stored as parquet location 
> 'hdfs://localhost:20500/test-warehouse/tmp.db/some_location';
> alter table b rename to bb;
> ERROR: InvalidOperationException: New location for this table hive.tmp.bb 
> already exists : hdfs://localhost:20500/test-warehouse/tmp.db/some_location 
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to