avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Creager <doug...@creagertino.net>
Subject Re: Avro C API: Union has no selected branch
Date Mon, 06 Oct 2014 19:24:56 GMT
> I'm having trouble with the avro_value_set_branch function. Hoping anyone
> can chime in here.
>
> avro_value_copy(&branch, &leftNode);
> //"Union has no selected branch" error is thrown here

You can only get that kind of error from an
avro_value_get_current_branch call.  `branch` and `leftNode` should be
records, so avro_value_copy shouldn't try to call that function on
`branch` or `leftNode` directly.  But part of copying a record is
copying its fields, so avro_value_copy will at some point try to call
get_current_branch on `leftNode`'s `left` and `right` children.  My
hunch is that's where the error is coming from.  Can you send us a
snippet on how `leftNode` is created?  You'll want to make sure to call
set_branch(1) and set_null() on both children of any leaf node, for
instance.

–doug

Mime
View raw message