You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Douglas Creager <do...@creagertino.net> on 2014/10/06 21:24:56 UTC

Re: Avro C API: Union has no selected branch

> 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