Skip to content
Open
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 @@ -383,9 +383,10 @@ protected FileStoreTable copyInternal(
public FileStoreTable copyWithLatestSchema() {
Optional<TableSchema> optionalLatestSchema = schemaManager().latest();
if (optionalLatestSchema.isPresent()) {
Map<String, String> options = tableSchema.options();
TableSchema newTableSchema = optionalLatestSchema.get();
newTableSchema = newTableSchema.copy(options);
TableSchema latestSchema = optionalLatestSchema.get();
Map<String, String> mergedOptions = new HashMap<>(latestSchema.options());
mergedOptions.putAll(tableSchema.options());
TableSchema newTableSchema = latestSchema.copy(mergedOptions);
SchemaValidation.validateTableSchema(newTableSchema);
return copy(newTableSchema);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,17 @@ public void testCopyWithLatestSchema() throws Exception {
"1|40|400|binary|varbinary|mapKey:mapVal|multiset|4000"));
}

@Test
public void testCopyWithLatestSchemaPicksUpAlteredOptions() throws Exception {
FileStoreTable table = createFileStoreTable();
SchemaManager schemaManager = new SchemaManager(table.fileIO(), table.location());

schemaManager.commitChanges(SchemaChange.setOption("my-custom-key", "my-custom-value"));

FileStoreTable updated = table.copyWithLatestSchema();
assertThat(updated.schema().options()).containsEntry("my-custom-key", "my-custom-value");
}

@Test
public void testConsumerIdNotBlank() throws Exception {
FileStoreTable table =
Expand Down