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

László Bodor updated HIVE-28045:
--------------------------------
    Description: 
{code}
create external table test_orc (a string, b string) partitioned by (pt string) 
STORED AS ORC;
insert into test_orc PARTITION(pt='1111') values ("aaaa","bbbb");

alter table test_orc add columns (c string); -- no CASCADE

insert overwrite table test_orc PARTITION(pt='1111') values ("aaa", "bbb", 
"ccc");
select * from test_orc;
{code}

returns
{code}
aaa     bbb     ccc     1111
{code}
which is unexpected without cascading the alter table, so the existing 
partition is supposed to be untouched, like below:
{code}
aaa     bbb     NULL    1111
{code}

the same applies to Avro, if there is no external schema defined (which is 
table level one)

repro: 
https://github.com/abstractdog/hive/commit/e0de2c52de288cafbba3bcec3533bc78890e22f9#diff-1ca7746de2d6586dc2d9c1edbe5c18ca35c37fd39382c030142c782a5326faa5

  was:
{code}
create external table test_orc (a string, b string) partitioned by (pt string) 
STORED AS ORC;
insert into test_orc PARTITION(pt='1111') values ("aaaa","bbbb");

alter table test_orc add columns (c string); -- no CASCADE

insert overwrite table test_orc PARTITION(pt='1111') values ("aaa", "bbb", 
"ccc");
select * from test_orc;
{code}

returns
{code}
aaa     bbb     ccc     1111
{code}
which is unexpected without cascading the alter table, so the existing 
partition is supposed to be untouched, like below:
{code}
aaa     bbb     NULL    1111
{code}

the same applies to Avro, if there is no external schema defined (which is 
table level one)


> Alter table without cascade seems to change metadata on existing partitions 
> (Avro, ORC)
> ---------------------------------------------------------------------------------------
>
>                 Key: HIVE-28045
>                 URL: https://issues.apache.org/jira/browse/HIVE-28045
>             Project: Hive
>          Issue Type: Bug
>            Reporter: László Bodor
>            Assignee: László Bodor
>            Priority: Major
>
> {code}
> create external table test_orc (a string, b string) partitioned by (pt 
> string) STORED AS ORC;
> insert into test_orc PARTITION(pt='1111') values ("aaaa","bbbb");
> alter table test_orc add columns (c string); -- no CASCADE
> insert overwrite table test_orc PARTITION(pt='1111') values ("aaa", "bbb", 
> "ccc");
> select * from test_orc;
> {code}
> returns
> {code}
> aaa   bbb     ccc     1111
> {code}
> which is unexpected without cascading the alter table, so the existing 
> partition is supposed to be untouched, like below:
> {code}
> aaa   bbb     NULL    1111
> {code}
> the same applies to Avro, if there is no external schema defined (which is 
> table level one)
> repro: 
> https://github.com/abstractdog/hive/commit/e0de2c52de288cafbba3bcec3533bc78890e22f9#diff-1ca7746de2d6586dc2d9c1edbe5c18ca35c37fd39382c030142c782a5326faa5



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

Reply via email to