nastra commented on code in PR #6480:
URL: https://github.com/apache/iceberg/pull/6480#discussion_r1055241225


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/source/SparkMicroBatchStream.java:
##########
@@ -207,7 +207,14 @@ private List<FileScanTask> planFiles(StreamingOffset 
startOffset, StreamingOffse
         currentOffset = new StreamingOffset(snapshotAfter.snapshotId(), 0L, 
false);
       }
 
-      if (!shouldProcess(table.snapshot(currentOffset.snapshotId()))) {
+      Snapshot snapshot = table.snapshot(currentOffset.snapshotId());
+
+      if (snapshot == null) {
+        throw new IllegalStateException(
+            String.format("Failed to find expected snapshot %d", 
snapshot.snapshotId()));
+      }
+

Review Comment:
   I'm curious whether we could just add this to `shouldProcess`:
   
   ```
      private boolean shouldProcess(Snapshot snapshot) {
   +    if (null == snapshot) {
   +      return false;
   +    }
        String op = snapshot.operation();
        switch (op) {
          case DataOperations.APPEND:
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to