Skip to content

Commit

Permalink
hotfix: transform with schema evolution issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiqian committed Aug 19, 2024
1 parent 0b341b6 commit e137bdf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,12 @@ public void testLenientSchemaEvolution() throws Exception {
"AddColumnEvent{tableId=%s.members, addedColumns=[ColumnWithPosition{column=`biological_sex` TINYINT, position=LAST, existedColumnName=null}]}",
"DataChangeEvent{tableId=%s.members, before=[], after=[1013, Fiona, null, null, 16.0, null], op=INSERT, meta=()}",
"TruncateTableEvent{tableId=%s.members}",
"DataChangeEvent{tableId=%s.members, before=[], after=[1014, Gem, null, null, 17.0, null], op=INSERT, meta=()}",
"DropTableEvent{tableId=%s.members}"));
"DataChangeEvent{tableId=%s.members, before=[], after=[1014, Gem, null, null, 17.0, null], op=INSERT, meta=()}"));

assertNotExists(
Collections.singletonList(
"Applied schema change event DropTableEvent{tableId=%s.members}"),
taskManagerConsumer);
}

@Test
Expand Down Expand Up @@ -404,6 +408,17 @@ private void validateResult(List<String> expectedEvents, ToStringConsumer consum
}
}

private void assertNotExists(List<String> unexpectedEvents, ToStringConsumer consumer) {
String consumerLog = consumer.toUtf8String();
System.out.println(consumerLog);
for (String event : unexpectedEvents) {
System.out.println("Assuming there's no " + event + " in logs...");
Assert.assertFalse(
consumerLog.contains(
String.format(event, schemaEvolveDatabase.getDatabaseName())));
}
}

private void waitUntilSpecificEvent(String event, ToStringConsumer consumer) throws Exception {
boolean result = false;
long endTimeout = System.currentTimeMillis() + SchemaEvolveE2eITCase.EVENT_WAITING_TIMEOUT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@ private List<SchemaChangeEvent> lenientizeSchemaChangeEvent(SchemaChangeEvent ev
}
return events;
}
case DROP_TABLE:
// We don't drop any tables in Lenient mode.
return Collections.emptyList();
default:
return Collections.singletonList(event);
}
Expand Down

0 comments on commit e137bdf

Please sign in to comment.