phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Biju Nair (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-2809) Alter table doesn't take into account current table definition
Date Mon, 04 Apr 2016 22:07:25 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-2809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15225166#comment-15225166
] 

Biju Nair commented on PHOENIX-2809:
------------------------------------

{{alter table}} statement without {{if exists}} also has the same behavior.

{noformat}
0: jdbc:phoenix:localhost:2181:/hbase> drop table test_alter;
No rows affected (8.555 seconds)
0: jdbc:phoenix:localhost:2181:/hbase> create table test_alter (TI tinyint not null primary
key);
No rows affected (1.267 seconds)
0: jdbc:phoenix:localhost:2181:/hbase> alter table test_alter add TI tinyint, col1 varchar;
No rows affected (5.943 seconds)
0: jdbc:phoenix:localhost:2181:/hbase> !describe test_alter
+------------+--------------+-------------+--------------+------------+------------+--------------+----------------+-----------------+-----------------+-----------+----------+-------------+--------------+
| TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  | COLUMN_NAME  | DATA_TYPE  | TYPE_NAME  | COLUMN_SIZE
 | BUFFER_LENGTH  | DECIMAL_DIGITS  | NUM_PREC_RADIX  | NULLABLE  | REMARKS  | COLUMN_DEF
 | SQL_DATA_TYP |
+------------+--------------+-------------+--------------+------------+------------+--------------+----------------+-----------------+-----------------+-----------+----------+-------------+--------------+
|            |              | TEST_ALTER  | TI           | -6         | TINYINT    | null
        | null           | null            | null            | 0         |          |    
        | null         |
|            |              | TEST_ALTER  | TI           | -6         | TINYINT    | null
        | null           | null            | null            | 1         |          |    
        | null         |
|            |              | TEST_ALTER  | COL1         | 12         | VARCHAR    | null
        | null           | null            | null            | 1         |          |    
        | null         |
+------------+--------------+-------------+--------------+------------+------------+--------------+----------------+-----------------+-----------------+-----------+----------+-------------+--------------+
{noformat}

> Alter table doesn't take into account current table definition
> --------------------------------------------------------------
>
>                 Key: PHOENIX-2809
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2809
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Biju Nair
>
> {{Alter table}} to add a new column with the column definition as an existing column
in the table succeeds while the expectation will be that the alter will fail. Following is
an example.
> {noformat}
> 0: jdbc:phoenix:localhost:2181:/hbase> create table test_alter (TI tinyint not null
primary key);
> No rows affected (1.299 seconds)
> 0: jdbc:phoenix:localhost:2181:/hbase> alter table test_alter add if not exists TI
tinyint, col1 varchar;
> No rows affected (15.962 seconds)
> 0: jdbc:phoenix:localhost:2181:/hbase> upsert into test_alter values (1,2,'add');
> 1 row affected (0.008 seconds)
> 0: jdbc:phoenix:localhost:2181:/hbase> select * from test_alter;
> +-----+-----+-------+
> | TI  | TI  | COL1  |
> +-----+-----+-------+
> | 1   | 1   | add   |
> +-----+-----+-------+
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message