-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avro 1.9+ dropping defaults #298
Comments
Are you asking for an exception to be thrown, instead of silently dropping the default? |
Using the avro-util AvroCompatibilityHelper default getter method, we should set the correct default value. |
I think it's more correct to throw an exception. Silently turning invalid default values into valid ones seems like it would just mask issues that originate/happen elsewhere. |
there is a bug in avro 1.9 if int default values are provided for float fields. we should be able to work around it in helper code. |
The helper builder drops the default value if the default value type does not match, eg if 0 is a default value of field type float then the following code will silently drop the default
public FieldBuilder19(Schema.Field other) {
if (other != null) {
_name = other.name();
_schema = other.schema();
_doc = other.doc();
_defaultVal = other.defaultVal(); // Its null for Avro 1.9+
_order = other.order(); // other.order() cannot be null under Avro 1.9.*
_props = other.getObjectProps();
}
}
The text was updated successfully, but these errors were encountered: