Skip to content

Commit

Permalink
[core] Fix raw convert fail for old storage ro table (#3438)
Browse files Browse the repository at this point in the history
  • Loading branch information
JingsongLi authored and yejunhao committed May 30, 2024
1 parent 69c895e commit fbfde85
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ private List<DataFileMeta> flatFiles(List<List<DataFileMeta>> section) {
}

private boolean withoutDeleteRow(DataFileMeta dataFileMeta) {
return dataFileMeta.deleteRowCount().map(count -> count == 0L).orElse(false);
// null to true to be compatible with old version
return dataFileMeta.deleteRowCount().map(count -> count == 0L).orElse(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static DataFileMeta newFile(
}

public static DataFileMeta newFile(
String name, int level, int minKey, int maxKey, long maxSequence, long deleteRowCount) {
String name, int level, int minKey, int maxKey, long maxSequence, Long deleteRowCount) {
return new DataFileMeta(
name,
maxKey - minKey + 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ public void testSplitRawConvertible() {
.containsExactlyInAnyOrder(
Pair.of(Arrays.asList("1", "2", "3", "4", "5"), false),
Pair.of(Collections.singletonList("6"), true));

// test convertible for old version
List<DataFileMeta> files6 =
Arrays.asList(
newFile("1", 1, 0, 10, 10L, null), newFile("2", 1, 10, 20, 20L, null));
assertThat(toNamesAndRawConvertible(mergeTreeSplitGenerator.splitForBatch(files6)))
.containsExactlyInAnyOrder(Pair.of(Arrays.asList("1", "2"), true));
}

@Test
Expand Down

0 comments on commit fbfde85

Please sign in to comment.