Re: Clarification of getSchema()#getIndexNamed(fieldName) in Avro 1.7.5 Java API
It's not clear to me what you're trying to do.
"Persistent" is a record with a field named "url" whose value is a union.
Schema recordSchema = Persistent.class.getSchema();
List<Field> fields = recordSchema.getFields();
Field urlField = recordSchema.getField("url");
// a field's position is within the record that contains the field
assert(urlField == fields.get(urlField.pos());
Schema urlFieldSchema = urlField.schema();
// an index in a union schema is the position of a schema within the union
assert(urlFieldSchema.getIndexNamed("null")) == 0);
assert(urlFieldSchema.getIndexNamed("string")) == 1);
Does this help?
On Mon, Jan 27, 2014 at 11:39 AM, Lewis John Mcgibbney
<[EMAIL PROTECTED]> wrote: