Maksim Zhuk created PHOENIX-3470:
------------------------------------
Summary: Boolean values discrepancy with HBase byte format
Key: PHOENIX-3470
URL: https://issues.apache.org/jira/browse/PHOENIX-3470
Project: Phoenix
Issue Type: Bug
Affects Versions: 4.8.0
Reporter: Maksim Zhuk
Fix For: verify
There's an inconsstency between Phoenix and Hbase in handling boolean "true" in
byte format.
[Phoenix|https://phoenix.apache.org/language/datatypes.html#boolean_type] -
"The binary representation is a single byte with 0 for false and 1 for true"
[HBase|https://hbase.apache.org/apidocs/src-html/org/apache/hadoop/hbase/util/Bytes.html#line.739]
- "True becomes -1 and false becomes 0"
{code:title=org.apache.hadoop.hbase.util.Bytes|borderStyle=solid}
/**
* Convert a boolean to a byte array. True becomes -1
* and false becomes 0.
*
* @param b value
* @return <code>b</code> encoded in a byte array.
*/
public static byte [] toBytes(final boolean b) {
return new byte[] { b ? (byte) -1 : (byte) 0 };
}
{code}
When Phoenix metadata is applied over the existing HBase table this causes
issues for queries like "... WHERE FIELD=TRUE ..." not finding any results.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)