Skip to content

Commit

Permalink
AVRO-3649: update Reflect data with comment
Browse files Browse the repository at this point in the history
  • Loading branch information
clesaec committed Sep 19, 2023
1 parent 7af5cc8 commit 0ab5949
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,8 @@ protected Object createSchemaDefaultValue(Type type, Field field, Schema fieldSc
AvroDefault defaultAnnotation = field.getAnnotation(AvroDefault.class);
defaultValue = (defaultAnnotation == null) ? null : Schema.parseJsonToObject(defaultAnnotation.value());

if (defaultValue == null && fieldSchema.getType() == Schema.Type.UNION) {
boolean acceptNull = fieldSchema.getTypes().stream().map(Schema::getType).anyMatch((t) -> t == Schema.Type.NULL);
if (acceptNull) {
defaultValue = JsonProperties.NULL_VALUE;
}
if (defaultValue == null && fieldSchema.isNullable()) {
defaultValue = JsonProperties.NULL_VALUE;
}
return defaultValue;
}
Expand Down

0 comments on commit 0ab5949

Please sign in to comment.