Hi Folks,
I have the following UNION field

{"name": "url", "type": ["null","string"], "default":null},

Once I've generated the Persistent class, I set a vlue for this field as
follows

page.setUrl(new Utf8("example.org"));

When however I attempt to get the field position of the URL UNION with

int fieldIndex = persistent.getSchema().getIndexNamed(fieldName);

I am thrown an org.apache.avro.AvroRuntimeException: Not a union
{"type":"record","name":"WebPage",... blah blahblah ... "default":null}]}

However if I do

int fieldIndex = persistent.getSchema().getField(fieldName).pos();

This works perfectly fine...

I've looked at this in my debugger for a bit and can't find a solution
right now. Any ideas please?
Thank you in advance
Lewis

-- 
*Lewis*

Reply via email to