You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Dudu Markovitz (JIRA)" <ji...@apache.org> on 2017/04/20 11:12:04 UTC

[jira] [Created] (HIVE-16486) schema changes for partitioned tables (RESTRICT, not CASCADE) other than adding columns at the end of a table, return wrong results

Dudu Markovitz created HIVE-16486:
-------------------------------------

             Summary: schema changes for partitioned tables (RESTRICT, not CASCADE) other than adding columns at the end of a table, return wrong results
                 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


-----------------------------------------------------------------------------
-- Use case 1: adding a column in the middle of a table
-----------------------------------------------------------------------------
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;

i1	i3	ver
1	2	1
3	4	1

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;

**************************************************************************
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

---------------------------------------------
-- Use case 2: dropping a column
---------------------------------------------

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;

i1	i2	ver
1	2	1
3	4	1

alter table mytable replace columns (i1 int);
insert into mytable partition(ver=2) values (5),(6);

select * from mytable;

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
**************************************************************************

select i1,i2 from mytable;

Error while compiling statement: FAILED: SemanticException [Error 10004]: Line 1:10 Invalid table alias or column reference 'i2': (possible column names are: i1, ver)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)