I am using Hbase version 2.0.2 and phoenix V5.0.0. I have an HBase table on top of that We have created Phoenix view, using the below steps
hbase(main):007:0> create 'phownix_test','details'
hbase(main):008:0> put 'phownix_test','1','details:MAC','1234567'
Took 1.5056 seconds
hbase(main):009:0> put 'phownix_test','1','details:deviceName','RAINDEVICE'
Took 0.0101 seconds
hbase(main):010:0> put 'phownix_test','1','details:CO2','234.543'
Took 0.0079 seconds
hbase(main):011:0> put 'phownix_test','1','details:latitude','9876543'
Took 0.0084 seconds
hbase(main):012:0> scan 'phownix_test'
ROW COLUMN+CELL
1 column=details:CO2, timestamp=1609744038606, value=234.543
1 column=details:MAC, timestamp=1609744024895, value=1234567
1 column=details:deviceName, timestamp=1609744031974, value=RAINDEVICE
1 column=details:latitude, timestamp=1609744051328, value=9876543
then I have created a phoenix view on top of the HBase table.
create view "phownix_test"("ID" VARCHAR primary key,"details"."MAC" UNSIGNED_INT,"details"."CO2" UNSIGNED_FLOAT,"details"."deviceName" VARCHAR,"details"."latitude" UNSIGNED_LONG);
while selecting data from phoenix view I am getting below error.
0: jdbc:phoenix:> select * from "phownix_test";
Error: ERROR 201 (22000): Illegal data. Expected length of at least 51 bytes, but had 23 (state=22000,code=201)
java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at least 51 bytes, but had 23
at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:503)
at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:150)
at org.apache.phoenix.schema.KeyValueSchema.next(KeyValueSchema.java:214)
at org.apache.phoenix.expression.ProjectedColumnExpression.evaluate(ProjectedColumnExpression.java:116)
at org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:69)
at org.apache.phoenix.jdbc.PhoenixResultSet.getString(PhoenixResultSet.java:635)
at sqlline.Rows$Row.<init>(Rows.java:183)
at sqlline.BufferedRows.<init>(BufferedRows.java:38)
at sqlline.SqlLine.print(SqlLine.java:1660)
at sqlline.Commands.execute(Commands.java:833)
at sqlline.Commands.sql(Commands.java:732)
at sqlline.SqlLine.dispatch(SqlLine.java:813)
at sqlline.SqlLine.begin(SqlLine.java:686)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:291)