You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "John Karp (JIRA)" <ji...@apache.org> on 2014/02/28 00:48:21 UTC

[jira] [Updated] (AVRO-1470) Perl API boolean type misencoded

     [ https://issues.apache.org/jira/browse/AVRO-1470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Karp updated AVRO-1470:
----------------------------

    Summary: Perl API boolean type misencoded  (was: Inconsistent handling of boolean type)

> Perl API boolean type misencoded
> --------------------------------
>
>                 Key: AVRO-1470
>                 URL: https://issues.apache.org/jira/browse/AVRO-1470
>             Project: Avro
>          Issue Type: Bug
>          Components: perl
>            Reporter: John Karp
>
> The boolean serialization code in BinaryEncoder.pm is:
> {noformat}
> $data ? \0x1 : \0x0
> {noformat}
> meaning anything false to perl, such as 0, '0', '', () and undef are encoded as zero, and everything else is encoded as one.
> However, the code used in Schema.pm to determine which union branch to use, is attempting to check for boolean-ness with:
> {noformat}
> m{yes|no|y|n|t|f|true|false}i
> {noformat}
> meaning only those particular strings are considered booleans, however they will all get encoded as '0' by BinaryEncoder.pm.
> I say 'attempts' because its actually matching this regex against the data type name $type, which in this context will always be 'boolean', instead of of the value $data.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)