[ 
https://issues.apache.org/jira/browse/HIVE-29004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

tanghui resolved HIVE-29004.
----------------------------
    Fix Version/s: 4.1.0
     Release Note: The expected correct behavior is that the table location 
should not be changed, and subsequent alter operations should not change the 
table location. There is a corresponding Jira 
https://issues.apache.org/jira/browse/HIVE-28570 that has been resolved
       Resolution: Fixed

> iceberg : after rename table ,execute add column will Restored the old 
> location
> -------------------------------------------------------------------------------
>
>                 Key: HIVE-29004
>                 URL: https://issues.apache.org/jira/browse/HIVE-29004
>             Project: Hive
>          Issue Type: Improvement
>          Components: Iceberg integration
>    Affects Versions: 4.0.0-beta-1, 4.0.1
>            Reporter: tanghui
>            Assignee: tanghui
>            Priority: Major
>              Labels: HIVE-29005, iceberg
>             Fix For: 4.1.0
>
>
>  after rename table ,execute add column will Restored the old location
> in beeline:
>  
> {code:java}
> CREATE TABLE n (i int) STORED BY ICEBERG STORED AS ORC;
> insert into n values(1),(2),(3);
> select * from  n ;
> ALTER TABLE n RENAME TO nn;
> show create table nn;
> {code}
> this location is :
> hdfs://nameservice1/warehouse/tablespace/external/hive/nn
> {code:java}
> +----------------------------------------------------+
> |                   createtab_stmt                   |
> +----------------------------------------------------+
> | CREATE EXTERNAL TABLE `nn`(                        |
> |   `i` int)                                         |
> | ROW FORMAT SERDE                                   |
> |   'org.apache.iceberg.mr.hive.HiveIcebergSerDe'    |
> | STORED BY                                          |
> |   'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler'  |
> |                                                    |
> | LOCATION                                           |
> |   'hdfs://nameservice1/warehouse/tablespace/external/hive/nn' |
> | TBLPROPERTIES (                                    |
> |   'TRANSLATED_TO_EXTERNAL'='TRUE',                 |
> |   'bucketing_version'='2',                         |
> |   
> 'current-schema'='{"type":"struct","schema-id":0,"fields":[{"id":1,"name":"i","required":false,"type":"int"}]}',
>   |
> |   'current-snapshot-id'='7947486275821849401',     |
> |   
> 'current-snapshot-summary'='{"added-data-files":"1","added-records":"3","added-files-size":"247","changed-partition-count":"1","total
>                                 
> -records":"3","total-files-size":"247","total-data-files":"1","total-delete-files":"0","total-position-deletes":"0","total-equality-delet
>                                 es":"0"}',  |
> |   'current-snapshot-timestamp-ms'='1749718607090',  |
> |   'engine.hive.enabled'='true',                    |
> |   'external.table.purge'='TRUE',                   |
> |   'iceberg.orc.files.only'='true',                 |
> |   
> 'metadata_location'='hdfs://nameservice1/warehouse/tablespace/external/hive/n/metadata/00001-63de9790-1399-4a52-9753-47f6cf271f1a.met
>                                 adata.json',  |
> |   
> 'previous_metadata_location'='hdfs://nameservice1/warehouse/tablespace/external/hive/n/metadata/00000-6382fc39-4e17-4626-b081-b200eec
>                                 b506a.metadata.json',  |
> |   'serialization.format'='1',                      |
> |   'snapshot-count'='1',                            |
> |   'table_type'='ICEBERG',                          |
> |   'transient_lastDdlTime'='1749718607',            |
> |   'uuid'='80dbfeb8-0443-4774-991a-f1a2f9bd482d',   |
> |   'write.format.default'='orc')                    |
> +----------------------------------------------------
>  
> {code}
>  
> when execute  :
> {code:java}
> ALTER TABLE nn ADD COLUMNS (name string);{code}
>  
> this location is will be change :
> hdfs://nameservice1/warehouse/tablespace/external/hive/n
>  
> {code:java}
>  
> +----------------------------------------------------+
> |                   createtab_stmt                   |
> +----------------------------------------------------+
> | CREATE EXTERNAL TABLE `nn`(                        |
> |   `i` int,                                         |
> |   `name` string)                                   |
> | ROW FORMAT SERDE                                   |
> |   'org.apache.iceberg.mr.hive.HiveIcebergSerDe'    |
> | STORED BY                                          |
> |   'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler'  |
> |                                                    |
> | LOCATION                                           |
> |   'hdfs://nameservice1/warehouse/tablespace/external/hive/n' |
> | TBLPROPERTIES (                                    |
> |   'TRANSLATED_TO_EXTERNAL'='TRUE',                 |
> |   'bucketing_version'='2',                         |
> |   
> 'current-schema'='{"type":"struct","schema-id":1,"fields":[{"id":1,"name":"i","required":false,"type":"int"},{"id":2,"name":"name","required":false,"type
>             ":"string"}]}',  |
> |   'current-snapshot-id'='7947486275821849401',     |
> |   
> 'current-snapshot-summary'='{"added-data-files":"1","added-records":"3","added-files-size":"247","changed-partition-count":"1","total-records":"3","total
>             
> -files-size":"247","total-data-files":"1","total-delete-files":"0","total-position-deletes":"0","total-equality-deletes":"0"}',
>   |
> |   'current-snapshot-timestamp-ms'='1749718607090',  |
> |   'engine.hive.enabled'='true',                    |
> |   'external.table.purge'='TRUE',                   |
> |   'iceberg.orc.files.only'='true',                 |
> |   
> 'metadata_location'='hdfs://nameservice1/warehouse/tablespace/external/hive/n/metadata/00002-80311e61-4cad-4b78-b2e7-e5f0745ab778.metadata.json',
>   |
> |   
> 'previous_metadata_location'='hdfs://nameservice1/warehouse/tablespace/external/hive/n/metadata/00001-63de9790-1399-4a52-9753-47f6cf271f1a.metadata.json'
>             ,  |
> |   'serialization.format'='1',                      |
> |   'snapshot-count'='1',                            |
> |   'table_type'='ICEBERG',                          |
> |   'transient_lastDdlTime'='1749718607',            |
> |   'uuid'='80dbfeb8-0443-4774-991a-f1a2f9bd482d',   |
> |   'write.format.default'='orc')                    |
> +----------------------------------------------------+
> {code}
>  
>  1、This statement <ADD COLUMNS> should not modify the location
>  2、statement <rename table> not modify the metadata_location
>  



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

Reply via email to