andreit-geomotiv commented on code in PR #16159:
URL: https://github.com/apache/kafka/pull/16159#discussion_r1628016250
##########
connect/transforms/src/main/java/org/apache/kafka/connect/transforms/InsertField.java:
##########
@@ -208,25 +250,26 @@ private Schema makeUpdatedSchema(Schema schema) {
builder.field(field.name(), field.schema());
}
- if (topicField != null) {
- builder.field(topicField.name, topicField.optional ?
Schema.OPTIONAL_STRING_SCHEMA : Schema.STRING_SCHEMA);
- }
- if (partitionField != null) {
- builder.field(partitionField.name, partitionField.optional ?
Schema.OPTIONAL_INT32_SCHEMA : Schema.INT32_SCHEMA);
- }
- if (offsetField != null) {
- builder.field(offsetField.name, offsetField.optional ?
Schema.OPTIONAL_INT64_SCHEMA : Schema.INT64_SCHEMA);
- }
- if (timestampField != null) {
- builder.field(timestampField.name, timestampField.optional ?
OPTIONAL_TIMESTAMP_SCHEMA : Timestamp.SCHEMA);
- }
- if (staticField != null) {
- builder.field(staticField.name, staticField.optional ?
Schema.OPTIONAL_STRING_SCHEMA : Schema.STRING_SCHEMA);
- }
+ addField(topicField, builder, Schema.OPTIONAL_STRING_SCHEMA,
Schema.STRING_SCHEMA);
+ addField(partitionField, builder, Schema.OPTIONAL_INT32_SCHEMA,
Schema.INT32_SCHEMA);
+ addField(offsetField, builder, Schema.OPTIONAL_INT64_SCHEMA,
Schema.INT64_SCHEMA);
+ addField(timestampField, builder, OPTIONAL_TIMESTAMP_SCHEMA,
Timestamp.SCHEMA);
+ addField(staticField, builder, Schema.OPTIONAL_STRING_SCHEMA,
Schema.STRING_SCHEMA);
+ addField(currentTimestampField, builder, OPTIONAL_TIMESTAMP_SCHEMA,
Timestamp.SCHEMA);
return builder.build();
}
+ private void addField(InsertionSpec spec, SchemaBuilder builder, Schema
optionalStringSchema, Schema stringSchema) {
Review Comment:
Sure, I haven't noticed it. Signature, was automatically generated by
IntelliJ IDEA.
--
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]