avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darryl Green (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AVRO-1994) C++ Code Generator Generates Invalid Code if Field is of type Null
Date Sun, 19 Feb 2017 14:30:44 GMT

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

Darryl Green updated AVRO-1994:
-------------------------------
    Attachment: another-AVRO-1994.patch

A patch using boost::blank as the unit type for compatibility with (future) use of boost::variant
(or anything that represents a union as something that holds a value, and its only a question
of what the type of that value is). See AVRO-855... 

> C++ Code Generator Generates Invalid Code if Field is of type Null
> ------------------------------------------------------------------
>
>                 Key: AVRO-1994
>                 URL: https://issues.apache.org/jira/browse/AVRO-1994
>             Project: Avro
>          Issue Type: Bug
>          Components: c++
>            Reporter: Darryl Green
>         Attachments: another-AVRO-1994.patch, AVRO-1994.patch
>
>
> An simple schema like this:
> {
>         "name": "TestPrimitiveTypes",
>         "type": "record",
>         "fields": [
>             { "name": "Null", "type": "null" },
>             { "name": "Boolean", "type": "boolean" },
>             { "name": "Int", "type": "int" },
>             { "name": "Long", "type": "long" },
>             { "name": "Float", "type": "float" },
>             { "name": "Double", "type": "double" },
>             { "name": "Bytes", "type": "bytes" },
>             { "name": "String", "type": "string" }
>         ]
>     }
> Generates this C++ struct.
> struct TestPrimitiveTypes {
>     $Undefined$ Null; // <-- BUG!
>     bool Boolean;
>     int32_t Int;
>     int64_t Long;
>     float Float;
>     double Double;
>     std::vector<uint8_t> Bytes;
>     std::string String;
>     TestPrimitiveTypes() :
>         Null($Undefined$()),
>         Boolean(bool()),
>         Int(int32_t()),
>         Long(int64_t()),
>         Float(float()),
>         Double(double()),
>         Bytes(std::vector<uint8_t>()),
>         String(std::string())
>         { }
> };
> Note the C++ type of the field Null is $Undefined$ which is obviously invalid/won't compile.




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message