phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "mabiao" <>
Subject Re: Fw:Phoenix number format problem
Date Wed, 09 Nov 2016 12:50:54 GMT
    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";<>;
Date:  Tue, Nov 8, 2016 11:06 AM
To:  "user"<>; 

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 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;    } 

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.


2016-11-08 9:47 GMT+08:00 马骉 <>:
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?




From: BiaoMa
View raw message