This is an automated email from the ASF dual-hosted git repository.

yuzelin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 417109da98 [hotfix] incremental-between-timestamp should return empty 
data instead of throwing exception (#5292)
417109da98 is described below

commit 417109da98539bb485f87a0bd4215f1099fb16bb
Author: yuzelin <[email protected]>
AuthorDate: Sat Mar 15 17:13:34 2025 +0800

    [hotfix] incremental-between-timestamp should return empty data instead of 
throwing exception (#5292)
---
 .../table/source/snapshot/IncrementalTimeStampStartingScanner.java  | 6 +++++-
 .../src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java | 6 ++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/IncrementalTimeStampStartingScanner.java
 
b/paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/IncrementalTimeStampStartingScanner.java
index bccb0b3d3a..26ece79d08 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/IncrementalTimeStampStartingScanner.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/IncrementalTimeStampStartingScanner.java
@@ -46,7 +46,11 @@ public class IncrementalTimeStampStartingScanner extends 
AbstractStartingScanner
 
     @Override
     public Result scan(SnapshotReader reader) {
-        Snapshot earliestSnapshot = 
snapshotManager.snapshot(snapshotManager.earliestSnapshotId());
+        Snapshot earliestSnapshot = snapshotManager.earliestSnapshot();
+        if (earliestSnapshot == null) {
+            return new NoSnapshot();
+        }
+
         Snapshot latestSnapshot = snapshotManager.latestSnapshot();
         if (startTimestamp > latestSnapshot.timeMillis()
                 || endTimestamp < earliestSnapshot.timeMillis()) {
diff --git 
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java
 
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java
index 0e9c9882fd..b16ef18deb 100644
--- 
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java
+++ 
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BatchFileStoreITCase.java
@@ -729,4 +729,10 @@ public class BatchFileStoreITCase extends 
CatalogITCaseBase {
                 "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";
         assertThat(sql(query)).containsExactly(Row.of(1, 11), Row.of(1, 12), 
Row.of(2, 22));
     }
+
+    @Test
+    public void testEmptyTableIncrementalBetweenTimestamp() {
+        assertThat(sql("SELECT * FROM T /*+ 
OPTIONS('incremental-between-timestamp'='0,1') */"))
+                .isEmpty();
+    }
 }

Reply via email to