You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2016/11/10 06:34:58 UTC
[jira] [Resolved] (PHOENIX-3470) Boolean values discrepancy with
HBase byte format
[ https://issues.apache.org/jira/browse/PHOENIX-3470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Taylor resolved PHOENIX-3470.
-----------------------------------
Resolution: Invalid
There's no correlation between how HBase serializes a boolean and how Phoenix does.
> 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)