Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Avro, mail # user - Primitive type aliases


Copy link to this message
-
Primitive type aliases
Jay Hacker 2013-04-12, 19:15
I'd like to be able to alias primitive types, for example to indicate that
a field of type "date" is really a string that I should treat specially.
The spec says "Named types and fields may have aliases," which suggests it
ought to work ("string" is a named type...).

I don't really know how to express an alias for a primitive, but things
like this:

{
    "type": "record",
    "name": "alias-test",
    "fields": [
        {"name": "start", "type": {"type": "string", "aliases": ["date"]}},
        {"name": "end",   "type": "date"}
    ]
}

don't work (at least not in the Python 1.7.4 implementation: 'Type property
"date" not a valid Avro schema').  How can I alias a primitive type, and if
not, why not?

Thanks.
+
Doug Cutting 2013-04-12, 21:09
+
Jeremy Kahn 2013-04-12, 21:22
+
Doug Cutting 2013-04-12, 21:35
+
Jay Hacker 2013-04-15, 16:03
+
Doug Cutting 2013-04-15, 16:26