[ https://issues.apache.org/jira/browse/PHOENIX-2783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15213752#comment-15213752 ]
Biju Nair commented on PHOENIX-2783: ------------------------------------ Thanks [~jamestaylor], [~sergey.soldatov] for your comments. Based on the comments, attached is a new patch for your review. The following are the some sample exceptions generated for the three scenarios identified earlier. 1. Index create statement with duplicate columns {noformat} 0: jdbc:phoenix:localhost:2181:/hbase> create table z (t1 varchar primary key, t2 varchar, t3 varchar); No rows affected (1.445 seconds) 0: jdbc:phoenix:localhost:2181:/hbase> create index idx on z (t2) include (t1,t3,t3); Error: ERROR 502 (42702): Column reference ambiguous or duplicate names. In create index columnName=IDX.0.0:T3 (state=42702,code=502) {noformat} 2.1 Table create statement with duplicate columns of different data types {noformat} 0: jdbc:phoenix:localhost:2181:/hbase> create table tbl2 (i integer not null primary key, i integer, i varchar); Error: ERROR 502 (42702): Column reference ambiguous or duplicate names. In create table columnName=TBL2.I (state=42702,code=502) {noformat} 2.2 Table create statement with duplicate columns of same data type {noformat} 0: jdbc:phoenix:localhost:2181:/hbase> create table tbl1 (i integer not null primary key, i integer); Error: ERROR 502 (42702): Column reference ambiguous or duplicate names. In create table columnName=TBL1.I (state=42702,code=502) {noformat} 3 Duplicate columns in create view statement {noformat} 0: jdbc:phoenix:localhost:2181:/hbase> create view z_view (t1_v varchar, t1_v varchar) as select * from z where t1 = 'TEST'; Error: ERROR 502 (42702): Column reference ambiguous or duplicate names. In create view columnName=Z_VIEW.T1_V (state=42702,code=502) {noformat} > Creating secondary index with duplicated columns makes the catalog corrupted > ---------------------------------------------------------------------------- > > Key: PHOENIX-2783 > URL: https://issues.apache.org/jira/browse/PHOENIX-2783 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.7.0 > Reporter: Sergey Soldatov > Assignee: Sergey Soldatov > Attachments: PHOENIX-2783-1.patch, PHOENIX-2783-2.patch, > PHOENIX-2783-3.patch, PHOENIX-2783-INIT.patch > > > Simple example > {noformat} > create table x (t1 varchar primary key, t2 varchar, t3 varchar); > create index idx on x (t2) include (t1,t3,t3); > {noformat} > cause an exception that duplicated column was detected, but the client > updates the catalog before throwing it and makes it unusable. All following > attempt to use table x cause an exception ArrayIndexOutOfBounds. This problem > was discussed on the user list recently. > The cause of the problem is that check for duplicated columns happen in > PTableImpl after MetaDataClient complete the server createTable. > The simple way to fix is to add a similar check in MetaDataClient before > createTable is called. > Possible someone can suggest a more elegant way to fix it? -- This message was sent by Atlassian JIRA (v6.3.4#6332)