[
https://issues.apache.org/jira/browse/HIVE-16486?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dudu Markovitz updated HIVE-16486:
----------------------------------
Summary: schema changes for partitioned tables (RESTRICT, not CASCADE)
seems to lead to unreasonable behaviour (was: schema changes for partitioned
tables (RESTRICT, not CASCADE) other than adding columns at the end of a table,
return wrong results)
> schema changes for partitioned tables (RESTRICT, not CASCADE) seems to lead
> to unreasonable behaviour
> -----------------------------------------------------------------------------------------------------
>
> Key: HIVE-16486
> URL: https://issues.apache.org/jira/browse/HIVE-16486
> Project: Hive
> Issue Type: Bug
> Components: Serializers/Deserializers
> Affects Versions: 1.1.0
> Reporter: Dudu Markovitz
>
> h4. Use case 1: adding a column in the middle of a table
> {code}
> create table mytable (i1 int,i3 int) partitioned by (ver int) stored as
> textfile;
> insert into mytable partition(ver=1) values (1,2),(3,4);
> select * from mytable;
> {code}
> ||i1||i3||ver||
> |1|2|1|
> |3|4|1|
> {code}
> alter table mytable replace columns (i1 int,i2 int,i3 int);
> insert into mytable partition(ver=2) values (5,6,7),(8,9,10);
> select * from mytable;
> {code}
> I would expect values 2 and 4 to appear under column i3 , In accordance with
> the columns definition of partition ver=1, but they appear under column i2.
> ||i1||i2||i3||ver||
> |1|2|(null)|1|
> |3|4|(null)|1|
> |5|6|7|2|
> |8|9|10|2|
> h4. Use case 2: dropping a column
> {code}
> create table mytable (i1 int,i2 int) partitioned by (ver int) stored as
> textfile;
> insert into mytable partition(ver=1) values (1,2),(3,4);
> select * from mytable;
> {code}
> ||i1||i2||ver||
> |1|2|1|
> |3|4|1|
> {code}
> alter table mytable replace columns (i1 int);
> insert into mytable partition(ver=2) values (5),(6);
> select * from mytable;
> {code}
> ||i1||ver||
> |1|1|
> |3|1|
> |5|2|
> |6|2|
> I would expect column i2 to be part of the columns list when asterisk is
> being used or at least that is would be available for explicit use
> {code}
> select i1,i2 from mytable;
> {code}
> {quote}
> {color:red}
> Error while compiling statement: FAILED: SemanticException [Error 10004]:
> Line 1:10 Invalid table alias or column reference 'i2': (possible column
> names are: i1, ver)
> {color}
> {quote}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)