Yuhao
Thank you for your reply and help.
I know that Phoenix would do some decode/encode action to unify the signed
and unsigned data type.
Where I dont'konw is that when I use it mapping an existing HBase table, i
occurred some encode/decode error, is there anyway to solve that?
Thanks a lot
------------------
Warmest Regards~
From BiaoMa
------------------ Original ------------------
From: "Yuhao Bi";<[email protected]>;
Date: Tue, Nov 8, 2016 11:06 AM
To: "user"<[email protected]>;
Subject: Re: Fw:Phoenix number format problem
Hi there,
I think it is because phoenix did some encode/decode work for different data
types.
In PTinyInt.java we have:
public int encodeByte(byte v, byte[] b, int o) {
checkForSufficientLength(b, o, Bytes.SIZEOF_BYTE); b[o] = (byte) (v ^
0x80); // Flip sign bit so that Short is binary comparable return
Bytes.SIZEOF_BYTE; }
and
public byte decodeByte(byte[] b, int o, SortOrder sortOrder) {
Preconditions.checkNotNull(sortOrder); checkForSufficientLength(b, o,
Bytes.SIZEOF_BYTE); int v; if (sortOrder == SortOrder.ASC) { v
= b[o] ^ 0x80; // Flip sign bit back } else { v = b[o] ^ 0xff ^
0x80; // Flip sign bit back } return (byte) v; }
I hope this answers your question.
Maybe you would rather use native jdbc interface or you may need to do it by
yourself.
Thanks.
Yuhao.
2016-11-08 9:47 GMT+08:00 马骉 <[email protected]>:
Hi , all
I use Phoenix4.8.1 to mapping a hbase0.98 table, while I put a 0
(tinyInt) to hbase, the phoenix read as -80,
Has any one had seen this problem yet?
Thx~
From: BiaoMa