Skip to content

Commit

Permalink
[core] Fix the issue of table copy (apache#2039)
Browse files Browse the repository at this point in the history
  • Loading branch information
miomiocat authored Oct 7, 2023
1 parent 17c04db commit a0f2697
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ public InnerStreamTableScan newStreamScan() {

@Override
public FileStoreTable copy(Map<String, String> dynamicOptions) {
if (dynamicOptions == null || dynamicOptions.isEmpty()) {
return this;
}

Map<String, String> options = tableSchema.options();
// check option is not immutable
dynamicOptions.forEach(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,19 @@ public void testExpireWithLimit() throws Exception {
commit.close();
}

@Test
public void testSchemaPathOption() throws Exception {
String fakePath = "fake path";
FileStoreTable table = createFileStoreTable(conf -> conf.set(CoreOptions.PATH, fakePath));
String originSchemaPath = table.schema().options().get(CoreOptions.PATH.key());
assertThat(originSchemaPath).isEqualTo(fakePath);
// reset PATH of schema option to table location
table = table.copy(Collections.emptyMap());
String schemaPath = table.schema().options().get(CoreOptions.PATH.key());
String tablePath = table.location().toString();
assertThat(schemaPath).isEqualTo(tablePath);
}

protected List<String> getResult(
TableRead read,
List<Split> splits,
Expand Down

0 comments on commit a0f2697

Please sign in to comment.