Skip to content

Commit

Permalink
[core] Fix merge schemas equal method issue
Browse files Browse the repository at this point in the history
  • Loading branch information
harveyyue committed Nov 11, 2024
1 parent ffc62a8 commit 32fd276
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -92,6 +93,27 @@ public void testMergeTableSchemas() {
assertThat(fields.get(4).type() instanceof RowType).isTrue();
}

@Test
public void testMergeTableSchemaNotChanges() {
// Init the table schema
DataField a = new DataField(0, "a", new IntType());
DataField b = new DataField(1, "b", new DoubleType());
TableSchema current =
new TableSchema(
0,
Lists.newArrayList(a, b),
3,
new ArrayList<>(),
Lists.newArrayList("a"),
new HashMap<>(),
"");

// fake the RowType of data with different field sequences
RowType t = new RowType(Lists.newArrayList(b, a));
TableSchema merged = SchemaMergingUtils.mergeSchemas(current, t, false);
assertThat(merged.id()).isEqualTo(0);
}

@Test
public void testMergeSchemas() {
// This will test both `mergeSchemas` and `merge` methods.
Expand Down

0 comments on commit 32fd276

Please sign in to comment.