Try using UNSIGNED DOUBLE (see
http://phoenix.apache.org/language/datatypes.html). "The purpose of this
type is to map to existing HBase data that was serialized using this
HBase utility
method. "

On Fri, Aug 5, 2016 at 10:07 AM, Tongzhou Wang (Simon) <
tongzhou.wang.1...@gmail.com> wrote:

> Phoenix has a different serialization method than HBase for numericals.
>
> > On Aug 5, 2016, at 08:16, Anupriya Chandran <anupriya...@gmail.com>
> wrote:
> >
> > Also when I tried integer and decimal, it returns some strange values
> which
> > was not at all related to the hbase insertions.
> >
> > create table "emp" (pk varchar primary key,"cf"."age" varchar ,
> "cf"."bmi"
> > integer);
> > select * from "emp";
> > +-----+------+--------------+
> > | PK  | age  |     bmi      |
> > +-----+------+--------------+
> > | 1   | 21   | -1305399758  |
> > | 2   | 28   | null         |
> > +-----+------+--------------+
> >
> >
> > create table "emp" (pk varchar primary key,"cf"."age" varchar ,
> "cf"."bmi"
> > DECIMAL);
> > select * from "emp";
> > +-----+------+---------------+
> > | PK  | age  |      bmi      |
> > +-----+------+---------------+
> > | 1   | 21   | -5.25551E+25  |
> > | 2   | 28   | null          |
> > +-----+------+---------------+
> >
> >
> >
> > On Fri, Aug 5, 2016 at 5:05 PM, Anupriya Chandran <anupriya...@gmail.com
> >
> > wrote:
> >
> >> I am using IBM BigInsights Hadoop distribution(Version 4.1) having Hbase
> >> version 1.1.1.
> >> My Apache phoenix version is 4.7. I am facing an issue as described
> below:
> >>
> >> I created a Hbase table as below inserted few rows :
> >>
> >> create 'emp' , 'cf'
> >>
> >> put 'emp' , '1' , 'cf:age' ,'21'
> >> put 'emp' , '2' , 'cf:age' ,'28'
> >> put 'emp' , '1' , 'cf:bmi' ,'21.2'
> >> put 'emp' , '2' , 'cf:bmi' ,'19.9'
> >>
> >> Then I created a table in Phoenix
> >>
> >> create table "emp" (pk varchar primary key,"cf"."age" varchar ,
> "cf"."bmi"
> >> DOUBLE);
> >>
> >> but querying the table results in below error. If i change DOUBLE data
> >> type to any other datatype ,it works fine. But I need double.
> >>
> >>
> >> select * from "emp";
> >> Error: ERROR 201 (22000): Illegal data. Expected length of at least 8
> >> bytes, but had 4 (state=22000,code=201)
> >> java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length
> of
> >> at least 8 bytes, but had 4
> >>        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.KeyValueSchema.next(
> >> KeyValueSchema.java:211)
> >>        at org.apache.phoenix.expression.ProjectedColumnExpression.
> >> evaluate(ProjectedColumnExpression.java:115)
> >>        at org.apache.phoenix.compile.ExpressionProjector.getValue(
> >> ExpressionProjector.java:69)
> >>        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)
> >>
> >> Please have a look and help me.
> >>
> >> Many thanks in advance.
> >>
> >> Anupriya
> >>
>

Reply via email to