Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ static class RecordConverter extends DataConverter<Record, GenericRecord> {

for (DataConverter<?, ?> converter : converters) {
final Optional<RecordField> recordField = recordSchema.getField(converter.getSourceFieldName());
if (recordField.isEmpty()) {
if (!recordField.isPresent()) {
final Types.NestedField missingField = schema.field(converter.getTargetFieldName());
if (missingField != null) {
getters.put(converter.getTargetFieldName(), createFieldGetter(convertSchemaTypeToDataType(missingField.type()), missingField.name(), missingField.isOptional()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public DataType fieldPartner(DataType dataType, int fieldId, String name) {
if (UnmatchedColumnBehavior.FAIL_UNMATCHED_COLUMN.equals(unmatchedColumnBehavior)) {
Validate.isTrue(mappedFieldName.isPresent(), String.format("Cannot find field with name '%s' in the record schema", name));
}
if (mappedFieldName.isEmpty()) {
if (!mappedFieldName.isPresent()) {
if (UnmatchedColumnBehavior.WARNING_UNMATCHED_COLUMN.equals(unmatchedColumnBehavior)) {
if (logger != null) {
logger.warn("Cannot find field with name '" + name + "' in the record schema, using the target schema for datatype and a null value");
Expand Down