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

ASF GitHub Bot updated AVRO-4230:
---------------------------------
    Labels: pull-request-available  (was: )

> Avro::BinaryEncoder's encode_map generates non-deterministic output which 
> makes writing unit tests more difficult
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-4230
>                 URL: https://issues.apache.org/jira/browse/AVRO-4230
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: perl
>    Affects Versions: 1.12.1
>            Reporter: Todd McDowell
>            Priority: Minor
>              Labels: pull-request-available
>   Original Estimate: 2h
>          Time Spent: 10m
>  Remaining Estimate: 1h 50m
>
> I was attempting to write unit tests for Perl code that was making use of 
> Avro::BinaryEncoder.  The code was specifically calling encode_map, which 
> encodes a Perl hash into binary.  However, since Perl's keys function does 
> not guarantee a consistent order of the hash's keys, the expected value from 
> encode_map occasionally fails to match the observed value, which causes the 
> test to fail.
> I recommend sorting the keys of the data in encode_map before the encoding 
> process to ensure a deterministic output from encode_map.  I've already 
> modified the code, but I needed to submit this issue before I could submit 
> the pull request change based on the instructions I read.  The deterministic 
> output from encode_map will make testing simpler.  I'll submit that change 
> for review shortly.
> Thanks for your attention.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to