Skip to content

Commit 0c41d57

Browse files
authored
[core] Fix that FilesTable cannot output level0 files when dv enabled (#6414)
1 parent c8f6eea commit 0c41d57

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

paimon-core/src/main/java/org/apache/paimon/table/system/FilesTable.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ private TableScan.Plan tablePlan(FileStoreTable storeTable) {
274274
return levelPredicate.test(
275275
GenericRow.of(null, null, null, null, null, level));
276276
});
277+
} else {
278+
// avoid that batchScanSkipLevel0 is true
279+
scan.withLevelFilter(level -> true);
277280
}
278281
return scan.plan();
279282
}

paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,4 +1016,13 @@ public void testBatchReadSourceWithoutSnapshot() {
10161016
"SELECT * FROM T /*+ OPTIONS('scan.dedicated-split-generation'='true') */"))
10171017
.hasSize(0);
10181018
}
1019+
1020+
@Test
1021+
public void testLevel0FileCanBeReadForFilesTable() {
1022+
sql(
1023+
"CREATE TABLE test_table (a int PRIMARY KEY NOT ENFORCED, b string) "
1024+
+ "WITH ('deletion-vectors.enabled' = 'true', 'write-only' = 'true');");
1025+
sql("INSERT INTO test_table VALUES (1, 'A')");
1026+
assertThat(sql("SELECT * FROM `test_table$files`")).isNotEmpty();
1027+
}
10191028
}

0 commit comments

Comments
 (0)