/[Apache-SVN]
ViewVC logotype

Revision 1057676


Jump to revision: Previous Next
Author: brucem
Date: Tue Jan 11 14:56:51 2011 UTC (13 years, 3 months ago)
Changed paths: 8
Log Message:
AVRO-727. This patchs several missing accessor and mutator methods for Avro
schemas and data instances.

For the most part, their definitions are straightforward.  Some notes for the
more interesting cases:

  - You can create the appropriate avro_datum_t instance for an
    arbitrary schema with the new avro_datum_from_schema() function.
    For records, this includes creating a datum instance for each of the
    record's fields.  Arrays and maps are initially created empty, while
    a union is created with none of its branches initially selected.
    This prevents the function from going into an endless loop for
    recursive schemas.

  - The active branch of a union can now be changed.  If the desired
    branch is already active, this has no result.  Otherwise, a new
    avro_datum_t is created for the new branch.

  - Map values can now be accessed by index as well as by key.  The
    index of a map entry is based on the order that it was added to the
    map.

  - Enum values can be retrieved or set either by integer value or by
    symbol name.

A couple of the new functions need access to the schema of a datum in
order to work.  These functions take in the schema instance as an extra
parameter.  A better solution might be to include a reference to a
schema object in each avro_datum_t instance.

Changed paths

Path Details
Directoryavro/trunk/CHANGES.txt modified , text changed
Directoryavro/trunk/lang/c/src/avro.h modified , text changed
Directoryavro/trunk/lang/c/src/datum.c modified , text changed
Directoryavro/trunk/lang/c/src/datum.h modified , text changed
Directoryavro/trunk/lang/c/src/schema.c modified , text changed
Directoryavro/trunk/lang/c/src/schema.h modified , text changed
Directoryavro/trunk/lang/c/tests/test_avro_data.c modified , text changed
Directoryavro/trunk/lang/c/tests/test_avro_schema.c modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26