" specified, you must use 'parquet' with " + this.getClass().getSimpleName() + ".");
}
}
}
GenericRecordBuilder builder = new GenericRecordBuilder(schema);
BeanWrapper beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(entity);
for (Schema.Field f : schema.getFields()) {
if (beanWrapper.isReadableProperty(f.name())) {
Schema fieldSchema = f.schema();
if (f.schema().getType().equals(Schema.Type.UNION)) {
for (Schema s : f.schema().getTypes()) {
if (!s.getName().equals("null")) {
fieldSchema = s;
}
}
}
if (fieldSchema.getType().equals(Schema.Type.RECORD)) {
throw new StoreException("Nested record currently not supported for field: " + f.name() +
" of type: " + beanWrapper.getPropertyDescriptor(f.name()).getPropertyType().getName());
} else {
if (fieldSchema.getType().equals(Schema.Type.BYTES)) {
ByteBuffer buffer = null;
Object value = beanWrapper.getPropertyValue(f.name());
if (value == null || value instanceof byte[]) {
if(value != null) {
byte[] bytes = (byte[]) value;
buffer = ByteBuffer.wrap(bytes);
}
builder.set(f.name(), buffer);
} else {
throw new StoreException("Don't know how to handle " + value.getClass() + " for " + fieldSchema);
}
} else {
builder.set(f.name(), beanWrapper.getPropertyValue(f.name()));
}
}
}
}
try {