mark-bathori commented on code in PR #7421:
URL: https://github.com/apache/nifi/pull/7421#discussion_r1273247443


##########
nifi-nar-bundles/nifi-iceberg-bundle/nifi-iceberg-processors/src/main/java/org/apache/nifi/processors/iceberg/converter/IcebergRecordConverter.java:
##########
@@ -123,8 +135,12 @@ private static class IcebergSchemaVisitor extends 
SchemaWithPartnerVisitor<DataT
             // set NiFi schema field names (sourceFieldName) in the data 
converters
             for (DataConverter<?, ?> converter : converters) {
                 final Optional<String> mappedFieldName = 
recordType.getNameMapping(converter.getTargetFieldName());
-                final Optional<RecordField> recordField = 
recordSchema.getField(mappedFieldName.get());
-                converter.setSourceFieldName(recordField.get().getFieldName());
+                if (mappedFieldName.isEmpty()) {
+                    
converter.setSourceFieldName(converter.getTargetFieldName());
+                } else {
+                    final Optional<RecordField> recordField = 
recordSchema.getField(mappedFieldName.get());
+                    
converter.setSourceFieldName(recordField.get().getFieldName());
+                }

Review Comment:
   > I think we shouldn't set the `target field name` to the` source field 
name` because it is confusing. The `source name` represents the `NiFi record 
field name` and the `target name `represents the `iceberg record field name`. 
We should leave it null and set only the target.
   
   This still needs to be addressed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to