Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page describes the Avro support for Ultra Format Definition Language (UFDL). This functionality enables you to compile Avro definitions, to encode data into, and from the Avro format. A schema in Avro is represented in JSON. You can implement non-protocol data issues in an Analysis agent.

...

Primitive TypeNotes
nullImplemented as type byte.
booleanValue must be true or false.
int32-bit signed.
long64-bit signed.
floatSingle precision (32-bit) IEEE 754 floating-point number.
doubleDouble precision (64-bit) IEEE 754 floating-point number.
bytesSequence of 8-bit unsigned bytes.
stringUnicode character sequence.


Complex TypeNotes
record

Supports the attributes: name, namespace, doc (optional), aliases (optional), fields.

The fields attribute is an array of listing fields and supports the attributes: name, doc (optional), type, default, order (optional), aliases (optional).

enumSupports the attributes: name, namespace, doc (optional), aliases (optional), symbols.
arraySupports the attribute: items
mapSupports the attribute: values
union

Implemented as a record with all types set to optional. If two values are set, both are encoded. If no values are set, none are encoded.

To specify a union value, you must use udrCreate.

fixed

Supports the attributes: name, namespace, aliases (optional), size

...

  • Line and Column are not fully implemented.
  • No string values are permitted in APL for the enum type.
  • Encoding the Avro object container file is not supported.
  • aliases are not fully supported.
  • default is not fully supported.
  • Cross references to other Ultra definitions are not supported.
  • array of arrays is not correctly implemented. For example, array of array of x is implemented with array of y, where y is a record with one value field. This value field is an array of x.
  • map of x is implemented via an array of y, where y is a record with two fields: key and value, where value is x.

...

To encode an Arvo data file, a format definition is included in the Ultra avro_block block in  in the Ultra format.

Info
titleExample - The xml_schema Ultra Code Block


Code Block
languagetext
themeEclipse
avro_block {
{
"namespace": "example.avro",
 "type": "record",
 "name": "User3",
 "fields": [
     {"name": "name", "type": {
             "name": "FullName2",
             "type": "record",
             "fields": [
                {"name": "firstName", "type": "string"},
                {"name": "lastName", "type": "string"}
                ]
             }
           
     },
     {"name": "favorite_number",  "type": ["int",    "null"]},
     {"name": "favorite_color",   "type": ["string", "null"]},
     {"name": "favorite_fotball_team", "type": {
         "name": "teams",
         "type": "enum",
         "namespace": "example.avro.teams",
         "symbols": ["Djurgården", "Hammarby", "Malmö", "Göteborg"]
         }
     },
     {"name": "ipAddresses", "type": {
         "type": "array",
         "items": [
            {
                 "name": "ipv4Address",
                 "type": "fixed",
                 "size": 4
             },
             {
                 "name": "ipv6Address",
                 "type": "fixed",
                 "size": 16
              }
           ]
         }
      },
      {"name": "favoriteFoodList", "type": {
          "name": "favoriteFood",
          "type": "record",
          "fields": [
            {"name": "dish", "type": "string"},
            {"name": "next", "type": ["null", "favoriteFood"]}
          ]
          }
      },
      {"name": "salary", "type": "long"},
      {"name": "myFixed", "type": { "name": "myfixed", "type":"fixed", "size": 4 }},
      {"name": "myFloat", "type": "float"},
      {"name": "myDouble", "type": "double"},
      {"name": "rootUsers", "type": {
              "type": "map",
              "values": {
                "name": "RootUsers",
                "type": "record",
                "fields": [
                  {"name": "rootUser", "type": "string"},
                  {"name": "privileges", "type": "int"}
                ]
              }
          }
          },
          {"name": "maps", "type": {
              "type": "array",
              "items": {
                "type": "map",
                "values": {
                    "name": "Map2",
                    "type": "record",
                    "fields": [
                        {"name": "favoriteUser", "type": "string"},
                        {"name": "favoriteNumber", "type": "int"}
                    ]
                }
             }
          }
          }
 ]
}
};



Scroll pagebreak