Author: martinkl
Date: Thu Jan 21 11:00:54 2016
New Revision: 1725903

URL: http://svn.apache.org/viewvc?rev=1725903&view=rev
Log:
AVRO-1663. C: Fix handling of namespaces for enum and fixed types.

Added:
    avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_enum
    avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fixed
    avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fullname
Modified:
    avro/branches/branch-1.8/CHANGES.txt
    avro/branches/branch-1.8/lang/c/src/allocation.c
    avro/branches/branch-1.8/lang/c/src/avro/allocation.h
    avro/branches/branch-1.8/lang/c/src/avro/schema.h
    avro/branches/branch-1.8/lang/c/src/schema.c
    avro/branches/branch-1.8/lang/c/src/schema.h
    avro/branches/branch-1.8/lang/c/src/schema_equal.c

Modified: avro/branches/branch-1.8/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/CHANGES.txt?rev=1725903&r1=1725902&r2=1725903&view=diff
==============================================================================
--- avro/branches/branch-1.8/CHANGES.txt (original)
+++ avro/branches/branch-1.8/CHANGES.txt Thu Jan 21 11:00:54 2016
@@ -261,6 +261,9 @@ Avro 1.8.0 (15 December 2015)
     AVRO-1691. C: Allow schemas consisting only of a primitive type.
     (Magnus Edenhill via martinkl)
 
+    AVRO-1663. C: Fix handling of namespaces for enum and fixed types.
+    (martinkl)
+
 Avro 1.7.7 (23 July 2014)
 
   NEW FEATURES

Modified: avro/branches/branch-1.8/lang/c/src/allocation.c
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/lang/c/src/allocation.c?rev=1725903&r1=1725902&r2=1725903&view=diff
==============================================================================
--- avro/branches/branch-1.8/lang/c/src/allocation.c (original)
+++ avro/branches/branch-1.8/lang/c/src/allocation.c Thu Jan 21 11:00:54 2016
@@ -88,6 +88,19 @@ char *avro_strdup(const char *str)
        return new_str;
 }
 
+char *avro_strndup(const char *str, size_t size)
+{
+       if (str == NULL) {
+               return NULL;
+       }
+
+       char *new_str = avro_str_alloc(size + 1);
+       memcpy(new_str, str, size);
+       new_str[size] = '\0';
+
+       return new_str;
+}
+
 void avro_str_free(char *str)
 {
        size_t  *size = ((size_t *) str) - 1;

Modified: avro/branches/branch-1.8/lang/c/src/avro/allocation.h
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/lang/c/src/avro/allocation.h?rev=1725903&r1=1725902&r2=1725903&view=diff
==============================================================================
--- avro/branches/branch-1.8/lang/c/src/avro/allocation.h (original)
+++ avro/branches/branch-1.8/lang/c/src/avro/allocation.h Thu Jan 21 11:00:54 
2016
@@ -82,6 +82,7 @@ void *avro_calloc(size_t count, size_t s
 
 char *avro_str_alloc(size_t str_size);
 char *avro_strdup(const char *str);
+char *avro_strndup(const char *str, size_t size);
 void avro_str_free(char *str);
 
 CLOSE_EXTERN

Modified: avro/branches/branch-1.8/lang/c/src/avro/schema.h
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/lang/c/src/avro/schema.h?rev=1725903&r1=1725902&r2=1725903&view=diff
==============================================================================
--- avro/branches/branch-1.8/lang/c/src/avro/schema.h (original)
+++ avro/branches/branch-1.8/lang/c/src/avro/schema.h Thu Jan 21 11:00:54 2016
@@ -54,6 +54,7 @@ int avro_schema_record_field_append(cons
 size_t avro_schema_record_size(const avro_schema_t record);
 
 avro_schema_t avro_schema_enum(const char *name);
+avro_schema_t avro_schema_enum_ns(const char *name, const char *space);
 const char *avro_schema_enum_get(const avro_schema_t enump,
                                 int index);
 int avro_schema_enum_get_by_name(const avro_schema_t enump,
@@ -62,6 +63,8 @@ int avro_schema_enum_symbol_append(const
                                   enump, const char *symbol);
 
 avro_schema_t avro_schema_fixed(const char *name, const int64_t len);
+avro_schema_t avro_schema_fixed_ns(const char *name, const char *space,
+                                  const int64_t len);
 int64_t avro_schema_fixed_size(const avro_schema_t fixed);
 
 avro_schema_t avro_schema_map(const avro_schema_t values);
@@ -103,6 +106,7 @@ int avro_schema_to_specific(avro_schema_
 avro_schema_t avro_schema_get_subschema(const avro_schema_t schema,
          const char *name);
 const char *avro_schema_name(const avro_schema_t schema);
+const char *avro_schema_namespace(const avro_schema_t schema);
 const char *avro_schema_type_name(const avro_schema_t schema);
 avro_schema_t avro_schema_copy(avro_schema_t schema);
 int avro_schema_equal(avro_schema_t a, avro_schema_t b);

Modified: avro/branches/branch-1.8/lang/c/src/schema.c
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/lang/c/src/schema.c?rev=1725903&r1=1725902&r2=1725903&view=diff
==============================================================================
--- avro/branches/branch-1.8/lang/c/src/schema.c (original)
+++ avro/branches/branch-1.8/lang/c/src/schema.c Thu Jan 21 11:00:54 2016
@@ -68,6 +68,22 @@ static int is_avro_id(const char *name)
        return 0;
 }
 
+/* Splits a qualified name by the last period, e.g. fullname "foo.bar.Baz" into
+ * name "Baz" and namespace "foo.bar". Sets name_out to the name part (pointing
+ * to a later position in the buffer that was passed in), and returns the
+ * namespace (as a newly allocated buffer using Avro's allocator). */
+static char *split_namespace_name(const char *fullname, const char **name_out)
+{
+       char *last_dot = strrchr(fullname, '.');
+       if (last_dot == NULL) {
+               *name_out = fullname;
+               return NULL;
+       } else {
+               *name_out = last_dot + 1;
+               return avro_strndup(fullname, last_dot - fullname);
+       }
+}
+
 static int record_free_foreach(int i, struct avro_record_field_t *field,
                               void *arg)
 {
@@ -132,6 +148,9 @@ static void avro_schema_free(avro_schema
                                struct avro_enum_schema_t *enump;
                                enump = avro_schema_to_enum(schema);
                                avro_str_free(enump->name);
+                               if (enump->space) {
+                                       avro_str_free(enump->space);
+                               }
                                st_foreach(enump->symbols, HASH_FUNCTION_CAST 
enum_free_foreach,
                                           0);
                                st_free_table(enump->symbols);
@@ -144,6 +163,9 @@ static void avro_schema_free(avro_schema
                                struct avro_fixed_schema_t *fixed;
                                fixed = avro_schema_to_fixed(schema);
                                avro_str_free((char *) fixed->name);
+                               if (fixed->space) {
+                                       avro_str_free((char *) fixed->space);
+                               }
                                avro_freet(struct avro_fixed_schema_t, fixed);
                        }
                        break;
@@ -285,6 +307,12 @@ avro_schema_t avro_schema_null(void)
 
 avro_schema_t avro_schema_fixed(const char *name, const int64_t size)
 {
+       return avro_schema_fixed_ns(name, NULL, size);
+}
+
+avro_schema_t avro_schema_fixed_ns(const char *name, const char *space,
+               const int64_t size)
+{
        if (!is_avro_id(name)) {
                avro_set_error("Invalid Avro identifier");
                return NULL;
@@ -297,6 +325,18 @@ avro_schema_t avro_schema_fixed(const ch
                return NULL;
        }
        fixed->name = avro_strdup(name);
+       if (!fixed->name) {
+               avro_set_error("Cannot allocate new fixed schema");
+               avro_freet(struct avro_fixed_schema_t, fixed);
+               return NULL;
+       }
+       fixed->space = space ? avro_strdup(space) : NULL;
+       if (space && !fixed->space) {
+               avro_set_error("Cannot allocate new fixed schema");
+               avro_str_free((char *) fixed->name);
+               avro_freet(struct avro_fixed_schema_t, fixed);
+               return NULL;
+       }
        fixed->size = size;
        avro_schema_init(&fixed->obj, AVRO_FIXED);
        return &fixed->obj;
@@ -435,6 +475,11 @@ avro_schema_t avro_schema_map_values(avr
 
 avro_schema_t avro_schema_enum(const char *name)
 {
+       return avro_schema_enum_ns(name, NULL);
+}
+
+avro_schema_t avro_schema_enum_ns(const char *name, const char *space)
+{
        if (!is_avro_id(name)) {
                avro_set_error("Invalid Avro identifier");
                return NULL;
@@ -451,9 +496,17 @@ avro_schema_t avro_schema_enum(const cha
                avro_freet(struct avro_enum_schema_t, enump);
                return NULL;
        }
+       enump->space = space ? avro_strdup(space) : NULL;
+       if (space && !enump->space) {
+               avro_set_error("Cannot allocate new enum schema");
+               avro_str_free(enump->name);
+               avro_freet(struct avro_enum_schema_t, enump);
+               return NULL;
+       }
        enump->symbols = st_init_numtable_with_size(DEFAULT_TABLE_SIZE);
        if (!enump->symbols) {
                avro_set_error("Cannot allocate new enum schema");
+               if (enump->space) avro_str_free(enump->space);
                avro_str_free(enump->name);
                avro_freet(struct avro_enum_schema_t, enump);
                return NULL;
@@ -462,6 +515,7 @@ avro_schema_t avro_schema_enum(const cha
        if (!enump->symbols_byname) {
                avro_set_error("Cannot allocate new enum schema");
                st_free_table(enump->symbols);
+               if (enump->space) avro_str_free(enump->space);
                avro_str_free(enump->name);
                avro_freet(struct avro_enum_schema_t, enump);
                return NULL;
@@ -701,8 +755,10 @@ qualify_name(const char *name, const cha
 }
 
 static int
-save_named_schemas(const char *name, const char *namespace, avro_schema_t 
schema, st_table *st)
+save_named_schemas(const avro_schema_t schema, st_table *st)
 {
+       const char *name = avro_schema_name(schema);
+       const char *namespace = avro_schema_namespace(schema);
        const char *full_name = qualify_name(name, namespace);
        int rval = st_insert(st, (st_data_t) full_name, (st_data_t) schema);
        return rval;
@@ -852,8 +908,7 @@ avro_schema_from_json_t(json_t *json, av
                            json_object_get(json, "namespace");
                        json_t *json_fields = json_object_get(json, "fields");
                        unsigned int num_fields;
-                       const char *record_name;
-                       const char *record_namespace;
+                       const char *fullname, *name;
 
                        if (!json_is_string(json_name)) {
                                avro_set_error("Record type must have a 
\"name\"");
@@ -868,20 +923,27 @@ avro_schema_from_json_t(json_t *json, av
                                avro_set_error("Record type must have at least 
one field");
                                return EINVAL;
                        }
-                       record_name = json_string_value(json_name);
-                       if (!record_name) {
+                       fullname = json_string_value(json_name);
+                       if (!fullname) {
                                avro_set_error("Record type must have a 
\"name\"");
                                return EINVAL;
                        }
-                       if (json_is_string(json_namespace)) {
-                               record_namespace =
-                                   json_string_value(json_namespace);
+
+                       if (strchr(fullname, '.')) {
+                               char *namespace = 
split_namespace_name(fullname, &name);
+                               *schema = avro_schema_record(name, namespace);
+                               avro_str_free(namespace);
+                       } else if (json_is_string(json_namespace)) {
+                               const char *namespace = 
json_string_value(json_namespace);
+                               *schema = avro_schema_record(fullname, 
namespace);
                        } else {
-                               record_namespace = parent_namespace;
+                               *schema = avro_schema_record(fullname, 
parent_namespace);
+                       }
+
+                       if (*schema == NULL) {
+                               return ENOMEM;
                        }
-                       *schema =
-                           avro_schema_record(record_name, record_namespace);
-                       if (save_named_schemas(record_name, record_namespace, 
*schema, named_schemas)) {
+                       if (save_named_schemas(*schema, named_schemas)) {
                                avro_set_error("Cannot save record schema");
                                return ENOMEM;
                        }
@@ -915,7 +977,8 @@ avro_schema_from_json_t(json_t *json, av
                                field_rval =
                                    avro_schema_from_json_t(json_field_type,
                                                            
&json_field_type_schema,
-                                                           named_schemas, 
record_namespace);
+                                                           named_schemas,
+                                                           
avro_schema_namespace(*schema));
                                if (field_rval) {
                                        avro_schema_decref(*schema);
                                        return field_rval;
@@ -938,7 +1001,8 @@ avro_schema_from_json_t(json_t *json, av
                {
                        json_t *json_name = json_object_get(json, "name");
                        json_t *json_symbols = json_object_get(json, "symbols");
-                       const char *name;
+                       json_t *json_namespace = json_object_get(json, 
"namespace");
+                       const char *fullname, *name;
                        unsigned int num_symbols;
 
                        if (!json_is_string(json_name)) {
@@ -950,8 +1014,8 @@ avro_schema_from_json_t(json_t *json, av
                                return EINVAL;
                        }
 
-                       name = json_string_value(json_name);
-                       if (!name) {
+                       fullname = json_string_value(json_name);
+                       if (!fullname) {
                                avro_set_error("Enum type must have a 
\"name\"");
                                return EINVAL;
                        }
@@ -960,8 +1024,23 @@ avro_schema_from_json_t(json_t *json, av
                                avro_set_error("Enum type must have at least 
one symbol");
                                return EINVAL;
                        }
-                       *schema = avro_schema_enum(name);
-                       if (save_named_schemas(name, parent_namespace, *schema, 
named_schemas)) {
+
+                       if (strchr(fullname, '.')) {
+                               char *namespace;
+                               namespace = split_namespace_name(fullname, 
&name);
+                               *schema = avro_schema_enum_ns(name, namespace);
+                               avro_str_free(namespace);
+                       } else if (json_is_string(json_namespace)) {
+                               const char *namespace = 
json_string_value(json_namespace);
+                               *schema = avro_schema_enum_ns(fullname, 
namespace);
+                       } else {
+                               *schema = avro_schema_enum_ns(fullname, 
parent_namespace);
+                       }
+
+                       if (*schema == NULL) {
+                               return ENOMEM;
+                       }
+                       if (save_named_schemas(*schema, named_schemas)) {
                                avro_set_error("Cannot save enum schema");
                                return ENOMEM;
                        }
@@ -1066,8 +1145,9 @@ avro_schema_from_json_t(json_t *json, av
                {
                        json_t *json_size = json_object_get(json, "size");
                        json_t *json_name = json_object_get(json, "name");
+                       json_t *json_namespace = json_object_get(json, 
"namespace");
                        json_int_t size;
-                       const char *name;
+                       const char *fullname, *name;
                        if (!json_is_integer(json_size)) {
                                avro_set_error("Fixed type must have a 
\"size\"");
                                return EINVAL;
@@ -1077,9 +1157,24 @@ avro_schema_from_json_t(json_t *json, av
                                return EINVAL;
                        }
                        size = json_integer_value(json_size);
-                       name = json_string_value(json_name);
-                       *schema = avro_schema_fixed(name, (int64_t) size);
-                       if (save_named_schemas(name, parent_namespace, *schema, 
named_schemas)) {
+                       fullname = json_string_value(json_name);
+
+                       if (strchr(fullname, '.')) {
+                               char *namespace;
+                               namespace = split_namespace_name(fullname, 
&name);
+                               *schema = avro_schema_fixed_ns(name, namespace, 
(int64_t) size);
+                               avro_str_free(namespace);
+                       } else if (json_is_string(json_namespace)) {
+                               const char *namespace = 
json_string_value(json_namespace);
+                               *schema = avro_schema_fixed_ns(fullname, 
namespace, (int64_t) size);
+                       } else {
+                               *schema = avro_schema_fixed_ns(fullname, 
parent_namespace, (int64_t) size);
+                       }
+
+                       if (*schema == NULL) {
+                               return ENOMEM;
+                       }
+                       if (save_named_schemas(*schema, named_schemas)) {
                                avro_set_error("Cannot save fixed schema");
                                return ENOMEM;
                        }
@@ -1212,7 +1307,8 @@ avro_schema_t avro_schema_copy(avro_sche
                {
                        struct avro_enum_schema_t *enum_schema =
                            avro_schema_to_enum(schema);
-                       new_schema = avro_schema_enum(enum_schema->name);
+                       new_schema = avro_schema_enum_ns(enum_schema->name,
+                                       enum_schema->space);
                        for (i = 0; i < enum_schema->symbols->num_entries; i++) 
{
                                union {
                                        st_data_t data;
@@ -1230,8 +1326,9 @@ avro_schema_t avro_schema_copy(avro_sche
                        struct avro_fixed_schema_t *fixed_schema =
                            avro_schema_to_fixed(schema);
                        new_schema =
-                           avro_schema_fixed(fixed_schema->name,
-                                             fixed_schema->size);
+                           avro_schema_fixed_ns(fixed_schema->name,
+                                                fixed_schema->space,
+                                                fixed_schema->size);
                }
                break;
 
@@ -1380,6 +1477,18 @@ const char *avro_schema_name(const avro_
        return NULL;
 }
 
+const char *avro_schema_namespace(const avro_schema_t schema)
+{
+       if (is_avro_record(schema)) {
+               return (avro_schema_to_record(schema))->space;
+       } else if (is_avro_enum(schema)) {
+               return (avro_schema_to_enum(schema))->space;
+       } else if (is_avro_fixed(schema)) {
+               return (avro_schema_to_fixed(schema))->space;
+       }
+       return NULL;
+}
+
 const char *avro_schema_type_name(const avro_schema_t schema)
 {
        if (is_avro_record(schema)) {
@@ -1529,7 +1638,7 @@ static int write_record(avro_writer_t ou
        check(rval, avro_write_str(out, "{\"type\":\"record\",\"name\":\""));
        check(rval, avro_write_str(out, record->name));
        check(rval, avro_write_str(out, "\","));
-       if (nullstrcmp(record->space, parent_namespace)) {
+       if (record->space && nullstrcmp(record->space, parent_namespace)) {
                check(rval, avro_write_str(out, "\"namespace\":\""));
                check(rval, avro_write_str(out, record->space));
                check(rval, avro_write_str(out, "\","));
@@ -1549,13 +1658,20 @@ static int write_record(avro_writer_t ou
        return avro_write_str(out, "]}");
 }
 
-static int write_enum(avro_writer_t out, const struct avro_enum_schema_t 
*enump)
+static int write_enum(avro_writer_t out, const struct avro_enum_schema_t 
*enump,
+                       const char *parent_namespace)
 {
        int rval;
        long i;
        check(rval, avro_write_str(out, "{\"type\":\"enum\",\"name\":\""));
        check(rval, avro_write_str(out, enump->name));
-       check(rval, avro_write_str(out, "\",\"symbols\":["));
+       check(rval, avro_write_str(out, "\","));
+       if (enump->space && nullstrcmp(enump->space, parent_namespace)) {
+               check(rval, avro_write_str(out, "\"namespace\":\""));
+               check(rval, avro_write_str(out, enump->space));
+               check(rval, avro_write_str(out, "\","));
+       }
+       check(rval, avro_write_str(out, "\"symbols\":["));
 
        for (i = 0; i < enump->symbols->num_entries; i++) {
                union {
@@ -1572,17 +1688,26 @@ static int write_enum(avro_writer_t out,
        }
        return avro_write_str(out, "]}");
 }
-static int write_fixed(avro_writer_t out, const struct avro_fixed_schema_t 
*fixed)
+
+static int write_fixed(avro_writer_t out, const struct avro_fixed_schema_t 
*fixed,
+                       const char *parent_namespace)
 {
        int rval;
        char size[16];
        check(rval, avro_write_str(out, "{\"type\":\"fixed\",\"name\":\""));
        check(rval, avro_write_str(out, fixed->name));
-       check(rval, avro_write_str(out, "\",\"size\":"));
+       check(rval, avro_write_str(out, "\","));
+       if (fixed->space && nullstrcmp(fixed->space, parent_namespace)) {
+               check(rval, avro_write_str(out, "\"namespace\":\""));
+               check(rval, avro_write_str(out, fixed->space));
+               check(rval, avro_write_str(out, "\","));
+       }
+       check(rval, avro_write_str(out, "\"size\":"));
        snprintf(size, sizeof(size), "%" PRId64, fixed->size);
        check(rval, avro_write_str(out, size));
        return avro_write_str(out, "}");
 }
+
 static int write_map(avro_writer_t out, const struct avro_map_schema_t *map,
                     const char *parent_namespace)
 {
@@ -1624,12 +1749,10 @@ static int write_link(avro_writer_t out,
 {
        int rval;
        check(rval, avro_write_str(out, "\""));
-       if (is_avro_record(link->to)) {
-               const char *namespace = avro_schema_to_record(link->to)->space;
-               if (nullstrcmp(namespace, parent_namespace)) {
-                       check(rval, avro_write_str(out, namespace));
-                       check(rval, avro_write_str(out, "."));
-               }
+       const char *namespace = avro_schema_namespace(link->to);
+       if (namespace && nullstrcmp(namespace, parent_namespace)) {
+               check(rval, avro_write_str(out, namespace));
+               check(rval, avro_write_str(out, "."));
        }
        check(rval, avro_write_str(out, avro_schema_name(link->to)));
        return avro_write_str(out, "\"");
@@ -1676,9 +1799,9 @@ avro_schema_to_json2(const avro_schema_t
        case AVRO_RECORD:
                return write_record(out, avro_schema_to_record(schema), 
parent_namespace);
        case AVRO_ENUM:
-               return write_enum(out, avro_schema_to_enum(schema));
+               return write_enum(out, avro_schema_to_enum(schema), 
parent_namespace);
        case AVRO_FIXED:
-               return write_fixed(out, avro_schema_to_fixed(schema));
+               return write_fixed(out, avro_schema_to_fixed(schema), 
parent_namespace);
        case AVRO_MAP:
                return write_map(out, avro_schema_to_map(schema), 
parent_namespace);
        case AVRO_ARRAY:

Modified: avro/branches/branch-1.8/lang/c/src/schema.h
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/lang/c/src/schema.h?rev=1725903&r1=1725902&r2=1725903&view=diff
==============================================================================
--- avro/branches/branch-1.8/lang/c/src/schema.h (original)
+++ avro/branches/branch-1.8/lang/c/src/schema.h Thu Jan 21 11:00:54 2016
@@ -43,6 +43,7 @@ struct avro_record_schema_t {
 struct avro_enum_schema_t {
        struct avro_obj_t obj;
        char *name;
+       char *space;
        st_table *symbols;
        st_table *symbols_byname;
 };
@@ -66,6 +67,7 @@ struct avro_union_schema_t {
 struct avro_fixed_schema_t {
        struct avro_obj_t obj;
        const char *name;
+       const char *space;
        int64_t size;
 };
 

Modified: avro/branches/branch-1.8/lang/c/src/schema_equal.c
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/lang/c/src/schema_equal.c?rev=1725903&r1=1725902&r2=1725903&view=diff
==============================================================================
--- avro/branches/branch-1.8/lang/c/src/schema_equal.c (original)
+++ avro/branches/branch-1.8/lang/c/src/schema_equal.c Thu Jan 21 11:00:54 2016
@@ -72,6 +72,9 @@ schema_enum_equal(struct avro_enum_schem
                 */
                return 0;
        }
+       if (nullstrcmp(a->space, b->space)) {
+               return 0;
+       }
        for (i = 0; i < a->symbols->num_entries; i++) {
                union {
                        st_data_t data;
@@ -100,6 +103,9 @@ schema_fixed_equal(struct avro_fixed_sch
                 */
                return 0;
        }
+       if (nullstrcmp(a->space, b->space)) {
+               return 0;
+       }
        return (a->size == b->size);
 }
 

Added: avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_enum
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_enum?rev=1725903&view=auto
==============================================================================
--- avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_enum 
(added)
+++ avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_enum Thu 
Jan 21 11:00:54 2016
@@ -0,0 +1,9 @@
+{"type": "record", "name": "org.apache.avro.tests.Hello", "fields": [
+  {"name": "f1", "type": {"type": "enum", "name": "MyEnum", "symbols": ["Foo", 
"Bar", "Baz"]}},
+  {"name": "f2", "type": "org.apache.avro.tests.MyEnum"},
+  {"name": "f3", "type": "MyEnum"},
+  {"name": "f4", "type": {"type": "enum", "name": "other.namespace.OtherEnum", 
"symbols": ["one", "two", "three"]}},
+  {"name": "f5", "type": "other.namespace.OtherEnum"},
+  {"name": "f6", "type": {"type": "enum", "name": "ThirdEnum", "namespace": 
"some.other", "symbols": ["Alice", "Bob"]}},
+  {"name": "f7", "type": "some.other.ThirdEnum"}
+]}

Added: avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fixed
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fixed?rev=1725903&view=auto
==============================================================================
--- avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fixed 
(added)
+++ avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fixed Thu 
Jan 21 11:00:54 2016
@@ -0,0 +1,9 @@
+{"type": "record", "name": "org.apache.avro.tests.Hello", "fields": [
+  {"name": "f1", "type": {"type": "fixed", "name": "MyFixed", "size": 16}},
+  {"name": "f2", "type": "org.apache.avro.tests.MyFixed"},
+  {"name": "f3", "type": "MyFixed"},
+  {"name": "f4", "type": {"type": "fixed", "name": 
"other.namespace.OtherFixed", "size": 18}},
+  {"name": "f5", "type": "other.namespace.OtherFixed"},
+  {"name": "f6", "type": {"type": "fixed", "name": "ThirdFixed", "namespace": 
"some.other", "size": 20}},
+  {"name": "f7", "type": "some.other.ThirdFixed"}
+]}

Added: 
avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fullname
URL: 
http://svn.apache.org/viewvc/avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fullname?rev=1725903&view=auto
==============================================================================
--- avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fullname 
(added)
+++ avro/branches/branch-1.8/lang/c/tests/schema_tests/pass/namespace_fullname 
Thu Jan 21 11:00:54 2016
@@ -0,0 +1,8 @@
+{"type": "record", "name": "x.Y", "fields": [
+  {"name": "e", "type":
+    {"type": "record", "name": "Z", "fields": [
+      {"name": "f", "type": "x.Y"},
+      {"name": "g", "type": "x.Z"}
+    ]}
+  }
+]}


Reply via email to