avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bin Guo (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AVRO-1350) Error in decoding enums using ResolvingDecoder
Date Mon, 01 Jul 2013 11:48:20 GMT

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

Bin Guo updated AVRO-1350:
--------------------------

    Description: 
We can't get a correct result when decoding enums using resolving decoder. 
e.g.
{code:title=An enum example}
{"type":"enum","name":"Mode","symbols":["MEMORY","DISK"]}
{code}
We encoded "DISK"(1), then decoded with resolving decoder, got "MEMORY"(0).
I examined the code and found that there is a sort after reading names of reader.
I could't quite understand the author's intention, but it really can not work well.
When decoding my enum, the return value is actually the *position of the sorted names*, and
obviously it's not correct.

{code:title=Symbol.cc}
Symbol Symbol::enumAdjustSymbol(const NodePtr& writer, const NodePtr& reader)
{
    vector<string> rs;
    size_t rc = reader->names();
    for (size_t i = 0; i < rc; ++i) {
        rs.push_back(reader->nameAt(i));
    }
    sort(rs.begin(), rs.end()); // the strange sort
{code}


  was:
We can't get a correct result when decoding enums using resolving decoder. 
e.g.
{code:title=An enum example}
{"type":"enum","name":"Mode","symbols":["MEMORY","DISK"]}
{code}
We encoded "DISK"(1), then decoded with resolving decoder, got "MEMORY"(0).
I examined the code and found that there is a sort after reading names of reader.
I could't quite understand the author's intention, but it really can not work well.

{code:title=Symbol.cc}
Symbol Symbol::enumAdjustSymbol(const NodePtr& writer, const NodePtr& reader)
{
    vector<string> rs;
    size_t rc = reader->names();
    for (size_t i = 0; i < rc; ++i) {
        rs.push_back(reader->nameAt(i));
    }
    sort(rs.begin(), rs.end()); // the strange sort
{code}


    
> Error in decoding enums using ResolvingDecoder
> ----------------------------------------------
>
>                 Key: AVRO-1350
>                 URL: https://issues.apache.org/jira/browse/AVRO-1350
>             Project: Avro
>          Issue Type: Bug
>          Components: c++
>    Affects Versions: 1.7.4
>            Reporter: Bin Guo
>
> We can't get a correct result when decoding enums using resolving decoder. 
> e.g.
> {code:title=An enum example}
> {"type":"enum","name":"Mode","symbols":["MEMORY","DISK"]}
> {code}
> We encoded "DISK"(1), then decoded with resolving decoder, got "MEMORY"(0).
> I examined the code and found that there is a sort after reading names of reader.
> I could't quite understand the author's intention, but it really can not work well.
> When decoding my enum, the return value is actually the *position of the sorted names*,
and obviously it's not correct.
> {code:title=Symbol.cc}
> Symbol Symbol::enumAdjustSymbol(const NodePtr& writer, const NodePtr& reader)
> {
>     vector<string> rs;
>     size_t rc = reader->names();
>     for (size_t i = 0; i < rc; ++i) {
>         rs.push_back(reader->nameAt(i));
>     }
>     sort(rs.begin(), rs.end()); // the strange sort
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message