Skip to content

Commit 417109d

Browse files
authored
[hotfix] incremental-between-timestamp should return empty data instead of throwing exception (#5292)
1 parent 192a1c4 commit 417109d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/IncrementalTimeStampStartingScanner.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ public IncrementalTimeStampStartingScanner(
4646

4747
@Override
4848
public Result scan(SnapshotReader reader) {
49-
Snapshot earliestSnapshot = snapshotManager.snapshot(snapshotManager.earliestSnapshotId());
49+
Snapshot earliestSnapshot = snapshotManager.earliestSnapshot();
50+
if (earliestSnapshot == null) {
51+
return new NoSnapshot();
52+
}
53+
5054
Snapshot latestSnapshot = snapshotManager.latestSnapshot();
5155
if (startTimestamp > latestSnapshot.timeMillis()
5256
|| endTimestamp < earliestSnapshot.timeMillis()) {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,4 +729,10 @@ public void testScanWithSpecifiedPartitions() {
729729
"SELECT Q.id, P.v FROM Q INNER JOIN P /*+ OPTIONS('scan.partitions' = 'pt=b;pt=c') */ ON Q.id = P.id ORDER BY Q.id, P.v";
730730
assertThat(sql(query)).containsExactly(Row.of(1, 11), Row.of(1, 12), Row.of(2, 22));
731731
}
732+
733+
@Test
734+
public void testEmptyTableIncrementalBetweenTimestamp() {
735+
assertThat(sql("SELECT * FROM T /*+ OPTIONS('incremental-between-timestamp'='0,1') */"))
736+
.isEmpty();
737+
}
732738
}

0 commit comments

Comments
 (0)