avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael San Soucie <sansou...@gmail.com>
Subject "SchemaParseException: No type" when creating a union within an array
Date Fri, 08 Apr 2016 15:25:17 GMT
Hello,

New to Avro, so apologies if the following is a misinformed question.

I'm hoping to create a schema where an array can be composed of items of a
set number of complex types.

The problem section looks something like the following:
{
      "name": "ARRAY_OF_ITEMS",
      "type": {
        "type": "array",
        "items": {
          "type": [
            {
              "name": "FIRST_OPTION",
              "type": "record",
              "fields": [
                {
                  "name": "SOME_FIELD",
                  "type": "string"
                }
              ]
            },
            {
              "name": "SECOND_OPTION",
              "type": "record",
              "fields": [
                {
                  "name": "SOME_FIELD",
                  "type": "string"
                }
              ]
            }
          ]
        }
      }
    }

For whatever reason, Avro, doesn't seem to like my union declaration, which
is composed of complex types as opposed to primitives.

Further, I'm not even sure an array's items can be defined as union. I
couldn't find any information about this in the documentation.

I'd love any insights on how to accomplish creating an array composed of
multiple possible types.

Thanks for any help or insights,

Michael

Mime
View raw message