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

Chinmay Kulkarni commented on PHOENIX-5712:
-------------------------------------------

The problem seems to be with view index id data type changes that went in to 
4.15. Here's a quicker repro with 4.x server and client:

CREATE TABLE IF NOT EXISTS S.T (A INTEGER PRIMARY KEY, B INTEGER);

CREATE VIEW IF NOT EXISTS S.V (new_col INTEGER) AS SELECT * FROM S.T;

CREATE INDEX IF NOT EXISTS GV_Idx ON S.V (new_col);

0: jdbc:phoenix:> select * from system.catalog where table_schem != 'SYSTEM';
Error: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes, 
but had 3 (state=22000,code=201)
java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at 
least 8 bytes, but had 3
        at 
org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:575)
        at 
org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:195)
        at 
org.apache.phoenix.schema.types.PDataType.checkForSufficientLength(PDataType.java:290)
        at 
org.apache.phoenix.schema.types.PLong$LongCodec.decodeLong(PLong.java:256)
        at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:115)
        at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:31)
        at 
org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1011)
        at 
org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:75)
        at 
org.apache.phoenix.jdbc.PhoenixResultSet.getObject(PhoenixResultSet.java:585)
        at sqlline.Rows$Row.<init>(Rows.java:196)
        at sqlline.BufferedRows.<init>(BufferedRows.java:38)
        at sqlline.SqlLine.print(SqlLine.java:1620)
        at sqlline.Commands.execute(Commands.java:825)
        at sqlline.Commands.sql(Commands.java:754)
        at sqlline.SqlLine.dispatch(SqlLine.java:646)
        at sqlline.SqlLine.begin(SqlLine.java:510)
        at sqlline.SqlLine.start(SqlLine.java:233)
        at sqlline.SqlLine.main(SqlLine.java:175)
0: jdbc:phoenix:> Closing: org.apache.phoenix.jdbc.PhoenixConnection

[~gjacoby] any pointers on why this is happening?

> Got SYSCAT  ILLEGAL_DATA exception after created tenant index on view
> ---------------------------------------------------------------------
>
>                 Key: PHOENIX-5712
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5712
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.15.0
>            Reporter: Xinyi Yan
>            Priority: Major
>             Fix For: 4.16.0
>
>
> repo
> //create a multi-tenant table on global connection
> CREATE TABLE A (TENANT_ID CHAR(15) NOT NULL, ID CHAR(3) NOT NULL, NUM BIGINT 
> CONSTRAINT PK PRIMARY KEY (TENANT_ID, ID)) MULTI_TENANT = true;
> // create view and index on tenant connection
> CREATE VIEW A_VIEW AS SELECT * FROM A;
> UPSERT INTO A_VIEW (ID, NUM) VALUES ('A', 1);
> CREATE INDEX A_VIEW_INDEX ON A_VIEW (NUM DESC) INCLUDE (ID);
> // qeury data on global connection 
> SELECT * RFOM SYSTEM.CATALOG;
> {code:java}
> Error: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes, 
> but had 3 (state=22000,code=201)
> java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at 
> least 8 bytes, but had 3
>         at 
> org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:559)
>         at 
> org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:195)
>         at 
> org.apache.phoenix.schema.types.PDataType.checkForSufficientLength(PDataType.java:290)
>         at 
> org.apache.phoenix.schema.types.PLong$LongCodec.decodeLong(PLong.java:256)
>         at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:115)
>         at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:31)
>         at 
> org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1011)
>         at 
> org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:75)
>         at 
> org.apache.phoenix.jdbc.PhoenixResultSet.getObject(PhoenixResultSet.java:585)
>         at sqlline.Rows$Row.<init>(Rows.java:258)
>         at sqlline.BufferedRows.nextList(BufferedRows.java:111)
>         at sqlline.BufferedRows.<init>(BufferedRows.java:52)
>         at sqlline.SqlLine.print(SqlLine.java:1623)
>         at sqlline.Commands.execute(Commands.java:982)
>         at sqlline.Commands.sql(Commands.java:906)
>         at sqlline.SqlLine.dispatch(SqlLine.java:740)
>         at sqlline.SqlLine.begin(SqlLine.java:557)
>         at sqlline.SqlLine.start(SqlLine.java:270)
>         at sqlline.SqlLine.main(SqlLine.java:201)
> {code}
> I tried to drop the view, and I was able to query the data from the SYSCATA. 
> I tested on 4.x-HBase1.3 and master branch, all branches have the same 
> behavior.
>  
> cc [~kadir] [~gjacoby] [~swaroopa]
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to