Skip to content

Commit 0d55170

Browse files
authored
[core] Fix that cannot get partition info if all files are in level-0 when enable dv. (apache#6531)
1 parent e908e18 commit 0d55170

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ public RecordReader<InternalRow> createReader(Split split) throws IOException {
182182
throw new IllegalArgumentException("Unsupported split: " + split.getClass());
183183
}
184184

185-
List<PartitionEntry> partitions = fileStoreTable.newScan().listPartitionEntries();
185+
List<PartitionEntry> partitions =
186+
fileStoreTable.newScan().withLevelFilter(level -> true).listPartitionEntries();
186187

187188
@SuppressWarnings("unchecked")
188189
CastExecutor<InternalRow, BinaryString> partitionCastExecutor =

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,4 +1025,14 @@ public void testLevel0FileCanBeReadForFilesTable() {
10251025
sql("INSERT INTO test_table VALUES (1, 'A')");
10261026
assertThat(sql("SELECT * FROM `test_table$files`")).isNotEmpty();
10271027
}
1028+
1029+
@Test
1030+
public void testLevel0FileCanBeReadForPartitionsTable() {
1031+
sql(
1032+
"CREATE TABLE test_table (a int PRIMARY KEY NOT ENFORCED, b string, dt string) "
1033+
+ "PARTITIONED BY (dt)"
1034+
+ "WITH ('deletion-vectors.enabled' = 'true', 'write-only' = 'true');");
1035+
sql("INSERT INTO test_table VALUES (1, 'A', '2024-12-01')");
1036+
assertThat(sql("SELECT * FROM `test_table$partitions`")).isNotEmpty();
1037+
}
10281038
}

0 commit comments

Comments
 (0)