avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Fondermann <bernd.fonderm...@gmail.com>
Subject Reading nested specific type
Date Mon, 06 May 2013 15:55:09 GMT
Hi all,

I have an avro schema with nested types, which is used to write a trevi
When reading/iterating the file using the outer specific type (WPPage), the
nested type (WPPageType, an enum) is only initialized as an int, the nested
enum type itself is not used. only after changing the generated code for
setting the WPPageType field in WPPage.put() this works.

What am I doing wrong?



this is the original field setter:
    case 3: type = (java.lang.Object)value$; break;
this is my modified setter:
    case 3: type = value$ == null ? null :
(generated.WPPageType)WPPageType.values()[(Integer)value$]; break;

this is my schema:

    "namespace": "generated",
    "type": "record",
    "name": "WPPage",
    "fields": [
            "name": "name",
            "type": "string"
            "name": "size",
            "type": "int"
            "name": "links",
            "type": {
                "type": "array",
                "items": "string"
            "name": "type",
            "type": [
                    "namespace": "generated",
                    "name": "WPPageType",
                    "type": "enum",
                    "symbols": ["article", "redirect", "disambiguation"]

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message