Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -69,13 +69,19 @@ public void configure(Map<String, ?> props) {

@Override
public R apply(R record) {
if (operatingSchema(record) == null) {
if (isTombstoneRecord(record)) {
return record;
} else if (operatingSchema(record) == null) {
return applySchemaless(record);
} else {
return applyWithSchema(record);
}
}

private boolean isTombstoneRecord(R record) {
return operatingValue(record) == null;
}

@Override
public void close() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,32 @@ public void testOptionalAndDefaultValuesNested() {
Schema transformedOptFieldSchema = SchemaBuilder.string().optional().defaultValue("child_default").build();
assertEquals(transformedOptFieldSchema, transformedSchema.field("opt_field").schema());
}

@Test
public void tombstoneEventWithoutSchemaShouldPassThrough() {
xformValue.configure(Collections.<String, String>emptyMap());

final SourceRecord record = new SourceRecord(null, null, "test", 0,
null, null);
Comment thread
kkonstantine marked this conversation as resolved.
Outdated

Comment thread
gharris1727 marked this conversation as resolved.
Outdated
final SourceRecord transformedRecord = xformValue.apply(record);

assertEquals(null, transformedRecord.value());
assertEquals(null, transformedRecord.valueSchema());
}

@Test
public void tombstoneEventWithSchemaShouldPassThrough() {
xformValue.configure(Collections.<String, String>emptyMap());

final Schema simpleStructSchema = SchemaBuilder.struct().name("name").version(1).doc("doc").field("magic", Schema.OPTIONAL_INT64_SCHEMA).build();

Comment thread
gharris1727 marked this conversation as resolved.
Outdated
final SourceRecord record = new SourceRecord(null, null, "test", 0,
simpleStructSchema, null);

Comment thread
gharris1727 marked this conversation as resolved.
Outdated
final SourceRecord transformedRecord = xformValue.apply(record);

assertEquals(null, transformedRecord.value());
assertEquals(simpleStructSchema, transformedRecord.valueSchema());
}
}