Schema actualFieldSchema = GenericData.get().induce(fieldData); if (actualFieldSchema.getType() == Schema.Type.RECORD) {
for (Object element : getArrayAsCollection(datum)) { if (elementType == null) { elementType = induce(element); } else if (!elementType.equals(induce(element))) { throw new AvroTypeException("No mixed type arrays."); for (Map.Entry<Object,Object> entry : map.entrySet()) { if (value == null) { value = induce(entry.getValue()); } else if (!value.equals(induce(entry.getValue()))) { throw new AvroTypeException("No mixed type map values.");
for (Object element : getArrayAsCollection(datum)) { if (elementType == null) { elementType = induce(element); } else if (!elementType.equals(induce(element))) { throw new AvroTypeException("No mixed type arrays."); for (Map.Entry<Object,Object> entry : map.entrySet()) { if (value == null) { value = induce(entry.getValue()); } else if (!value.equals(induce(entry.getValue()))) { throw new AvroTypeException("No mixed type map values.");
Schema induced = GenericData.get().induce(datum); assertEquals("Induced schema does not match.", schema, induced);
return GenericData.get().induce(obj); } catch (Exception e) { throw new RuntimeException(e);
return GenericData.get().induce(obj); } catch (Exception e) { throw new RuntimeException(e);
private void projectData(GenericRecord source, GenericRecord target) { for (Field fld : target.getSchema().getFields()) { if (fld.schema().getType() == Type.UNION) { Object obj = source.get(fld.name()); Schema sourceSchema = GenericData.get().induce(obj); if (sourceSchema.getType() == Type.RECORD) { for (Schema type : fld.schema().getTypes()) { if (type.getFullName().equals(sourceSchema.getFullName())) { GenericRecord record = new GenericData.Record(type); target.put(fld.name(), record); projectData((GenericRecord) obj, record); break; } } } else { target.put(fld.name(), source.get(fld.name())); } } else if (fld.schema().getType() == Type.RECORD) { GenericRecord record = (GenericRecord) target.get(fld.name()); if (record == null) { record = new GenericData.Record(fld.schema()); target.put(fld.name(), record); } projectData((GenericRecord) source.get(fld.name()), record); } else { target.put(fld.name(), source.get(fld.name())); } } }
Schema actualFieldSchema = GenericData.get().induce(fieldData); if (actualFieldSchema.getType() == Schema.Type.RECORD) {
Schema actualFieldSchema = GenericData.get().induce(fieldData); if (actualFieldSchema.getType() == Schema.Type.RECORD) {
for (Object element : (Collection)datum) { if (elementType == null) { elementType = induce(element); } else if (!elementType.equals(induce(element))) { throw new AvroTypeException("No mixed type arrays."); for (Map.Entry<Object,Object> entry : map.entrySet()) { if (value == null) { value = induce(entry.getValue()); } else if (!value.equals(induce(entry.getValue()))) { throw new AvroTypeException("No mixed type map values.");
for (Object element : (GenericArray)datum) { if (elementType == null) { elementType = induce(element); } else if (!elementType.equals(induce(element))) { throw new AvroTypeException("No mixed type arrays."); for (Map.Entry<Object,Object> entry : map.entrySet()) { if (value == null) { value = induce(entry.getValue()); } else if (!value.equals(induce(entry.getValue()))) { throw new AvroTypeException("No mixed type map values.");
for (Object element : (Collection<?>)datum) { if (elementType == null) { elementType = induce(element); } else if (!elementType.equals(induce(element))) { throw new AvroTypeException("No mixed type arrays."); for (Map.Entry<Object,Object> entry : map.entrySet()) { if (value == null) { value = induce(entry.getValue()); } else if (!value.equals(induce(entry.getValue()))) { throw new AvroTypeException("No mixed type map values.");
for (Object element : getArrayAsCollection(datum)) { if (elementType == null) { elementType = induce(element); } else if (!elementType.equals(induce(element))) { throw new AvroTypeException("No mixed type arrays."); for (Map.Entry<Object,Object> entry : map.entrySet()) { if (value == null) { value = induce(entry.getValue()); } else if (!value.equals(induce(entry.getValue()))) { throw new AvroTypeException("No mixed type map values.");