John Karp created AVRO-1470:
-------------------------------

             Summary: Inconsistent handling of boolean type
                 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:
{{$data ? \0x1 : \0x0}}
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:
{{m{yes|no|y|n|t|f|true|false}i;}}
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)

Reply via email to