Hi Dong-iL Kim,

As you said , you are inserting data from hbase, so the exception can be
seen if the primary key and columns are not properly represented or encoded
as per Phoenix.

Please see for more details:-
https://phoenix.apache.org/faq.html#How_I_map_Phoenix_table_to_an_existing_HBase_table

If you have a composite key , it is always better to insert data from
phoenix only.

Regards,
Ankit Singhal

On Fri, Aug 5, 2016 at 8:00 PM, Dong-iL, Kim <[email protected]> wrote:

> oh.  phoenix version is 4.7.0 and on EMR.
> Thx.
>
> > On Aug 5, 2016, at 11:27 PM, Dong-iL, Kim <[email protected]> wrote:
> >
> > Hi
> > I’ve create a table in phoenix.
> >
> > CREATE TABLE WINLOSS (
> >    dayNumber VARCHAR NOT NULL,
> >    type VARCHAR NOT NULL,
> >    historyId VARCHAR NOT NULL,
> >    seq INTEGER NOT NULL,
> >    timestamp BIGINT,
> >    name VARCHAR,
> >    gameType VARCHAR,
> >    playType VARCHAR,
> >    gameKind VARCHAR,
> >    onRitt BOOLEAN,
> >    contributedAmount BIGINT,
> >    payAmount BIGINT
> >    CONSTRAINT rowid PRIMARY KEY(dayNumber, type, historyId, seq)
> > ) default_column_family = 'winloss';
> >
> > insert data through hbase.
> >
> > and I got an error when querying table.
> > just like this.
> >
> > select * from WINLESS;
> >
> > Error: ERROR 201 (22000): Illegal data. Expected length of at least 4
> bytes, but had 1 (state=22000,code=201)
> > java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length
> of at least 4 bytes, but had 1
> >       at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.
> newException(SQLExceptionCode.java:422)
> >       at org.apache.phoenix.exception.SQLExceptionInfo.buildException(
> SQLExceptionInfo.java:145)
> >       at org.apache.phoenix.schema.types.PDataType.
> checkForSufficientLength(PDataType.java:274)
> >       at org.apache.phoenix.schema.types.PInteger$IntCodec.
> decodeInt(PInteger.java:183)
> >       at org.apache.phoenix.schema.types.PInteger.toObject(
> PInteger.java:81)
> >       at org.apache.phoenix.schema.types.PInteger.toObject(
> PInteger.java:28)
> >       at org.apache.phoenix.schema.types.PDataType.toObject(
> PDataType.java:985)
> >       at org.apache.phoenix.compile.ExpressionProjector.getValue(
> ExpressionProjector.java:75)
> >       at org.apache.phoenix.jdbc.PhoenixResultSet.getObject(
> PhoenixResultSet.java:524)
> >       at sqlline.Rows$Row.<init>(Rows.java:157)
> >       at sqlline.BufferedRows.<init>(BufferedRows.java:38)
> >       at sqlline.SqlLine.print(SqlLine.java:1650)
> >       at sqlline.Commands.execute(Commands.java:833)
> >       at sqlline.Commands.sql(Commands.java:732)
> >       at sqlline.SqlLine.dispatch(SqlLine.java:808)
> >       at sqlline.SqlLine.begin(SqlLine.java:681)
> >       at sqlline.SqlLine.start(SqlLine.java:398)
> >       at sqlline.SqlLine.main(SqlLine.java:292)
> >
> > what shall I do?
> >
> > Thanks.
>
>

Reply via email to