[
https://issues.apache.org/jira/browse/HIVE-24920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17524983#comment-17524983
]
tanghui edited comment on HIVE-24920 at 4/20/22 1:18 PM:
---------------------------------------------------------
After the patch is updated, the partition table location and hdfs data
directory are displayed normally, but the partition location of the table in
the SDS in the Hive metabase is still displayed as the location of the old
table, resulting in no data in the query partition.
------------------------------------------------------------
set hive.create.as.external.legacy=true;
CREATE TABLE part_test(
c1 string
,c2 string
)PARTITIONED BY (dat string)
insert into part_test values ("11","th","20220101")
insert into part_test values ("22","th","20220102")
alter table part_test rename to part_test11;
--this resulting in no data in the query partition.
select * from part_test11 where dat="20220101";
---------------------------------------------------------------------------------------------
SDS in the Hive metabase:
select SDS.LOCATION from TBLS,SDS where TBLS.TBL_NAME="part_test11" AND
TBLS.TBL_ID=SDS.CD_ID;
---------------------------------------------------------------------------------------------------
|LOCATION|
|hdfs://nameservice1/warehouse/tablespace/external/hive/part_test11|
|hdfs://nameservice1/warehouse/tablespace/external/hive/part_test/dat=20220101|
|hdfs://nameservice1/warehouse/tablespace/external/hive/part_test/dat=20220102|
---------------------------------------------------------------------------------------------------
We need to modify the partition location of the table in SDS to ensure that the
query results are normal
was (Author: sanguines):
After the patch is updated, the partition table location and hdfs data
directory are displayed normally, but the partition location of the table in
the SDS in the Hive metabase is still displayed as the location of the old
table, resulting in no data in the query partition.
------------------------------------------------------------
CREATE TABLE part_test(
c1 string
,c2 string
)PARTITIONED BY (dat string)
insert into part_test values ("11","th","20220101")
insert into part_test values ("22","th","20220102")
alter table part_test rename to part_test11;
--this resulting in no data in the query partition.
select * from part_test11 where dat="20220101";
---------------------------------------------------------------------------------------------
SDS in the Hive metabase:
select SDS.LOCATION from TBLS,SDS where TBLS.TBL_NAME="part_test11" AND
TBLS.TBL_ID=SDS.CD_ID;
---------------------------------------------------------------------------------------------------
|LOCATION|
|hdfs://nameservice1/warehouse/tablespace/external/hive/part_test11|
|hdfs://nameservice1/warehouse/tablespace/external/hive/part_test/dat=20220101|
|hdfs://nameservice1/warehouse/tablespace/external/hive/part_test/dat=20220102|
---------------------------------------------------------------------------------------------------
We need to modify the partition location of the table in SDS to ensure that the
query results are normal
> 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: metastore_translator, pull-request-available
> Fix For: 4.0.0, 4.0.0-alpha-1
>
> Time Spent: 1h 20m
> 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.20.7#820007)