#include <kvstore.h> kv_error_t kv_avro_generic_to_object(kv_value_t *value, avro_value_t *avro_value, avro_schema_t reader_schema);
Converts (deserializes) a kv_value_t
to an Avro
value.
For deserialization to succeed, the reader_schema (which is optional) need not be loaded into the store. It is only an error to attempt to put an Avro value with a schema that is not loaded into the store.
This function optionally supports schema evolution by resolving the
reader_schema with the
value's writer schema. If the two
are identical, there are no issues. If they are not identical,
but they are compatible, the result will be created based on
Avro's resolution rules. If they are not compatible, the error
KV_AVRO
is returned, and additional information
may be available using kv_get_last_error().
Note that the The Avro C API does not currently support default values. This means that if the reader_schema adds fields relative to the existing value, those fields will be zero. Further, unless Avro itself was built such that it will allow missing fields in the resolved writer schema (see the build instructions), the operation will fail entirely because of mismatched schema.
The value parameter is Oracle NoSQL Database value that you want to deserialize into a generic Avro value.
The avro_value parameter is a pointer to the destination object for the deserialized data.