zhengzengprc commented on a change in pull request #3039:
URL: https://github.com/apache/iceberg/pull/3039#discussion_r713520682



##########
File path: 
spark3/src/main/java/org/apache/iceberg/spark/source/SparkMicroBatchStream.java
##########
@@ -238,9 +247,8 @@ public StreamingOffset initialOffset() {
       }
 
       table.refresh();
-      StreamingOffset offset = table.currentSnapshot() == null ?
-          StreamingOffset.START_OFFSET :
-          new StreamingOffset(SnapshotUtil.oldestSnapshot(table).snapshotId(), 
0, false);
+      StreamingOffset offset = isStreamEmpty(table, fromTimestamp) ? 
StreamingOffset.START_OFFSET :
+          new StreamingOffset(SnapshotUtil.oldestSnapshot(table, 
fromTimestamp).snapshotId(), 0, false);

Review comment:
       Not sure I understanding the second question correctly. Let's take an 
example
   Let's say we have snapshots 5, 10, 15, 20, 25
   Current snapshot is 25
   fromTimestamp is 30
   In such case isStreamEmpty will return false, offset will be -1
   so we will read everything in the stream 5, 10, 15, 20, 25. I think this is 
the expected behavior. @SreeramGarlapati what do you think?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to