avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Karp (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AVRO-1521) Inconsistent behavior of Perl API with 'boolean' type
Date Fri, 30 May 2014 23:12:02 GMT

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

John Karp updated AVRO-1521:

    Fix Version/s: 1.8.0

> Inconsistent behavior of Perl API with 'boolean' type
> -----------------------------------------------------
>                 Key: AVRO-1521
>                 URL: https://issues.apache.org/jira/browse/AVRO-1521
>             Project: Avro
>          Issue Type: Bug
>          Components: perl
>            Reporter: John Karp
>            Assignee: John Karp
>             Fix For: 1.8.0
> The perl boolean serialization code in BinaryEncoder.pm encodes anything false to perl,
such as 0, '0', '', () and undef, as false, and anything true to perl, which is literally
everything else, as true.
> Inconsistent with the above serialization, the code used in Schema.pm to determine which
union branch to use, is checking for boolean-ness with:
> {noformat}
> m{yes|no|y|n|t|f|true|false}i
> {noformat}
> meaning only those particular strings are considered booleans.
> So all those values, including 'no' 'n' 'f' and 'false', still get serialized to true.
> We could just standardize on one of the two and use it consistently. But neither works
that well in unions, because unless you put the boolean type last in the union definition,
a wide variety of data will be downcast to boolean type.
> Perl has no built-in or standardized boolean type, so there's no solution like we have
in the other language Avro APIs. But we could do as the perl JSON module does, and define
objects for true and false.

This message was sent by Atlassian JIRA

View raw message