flyxu1991 opened a new issue #3859:
URL: https://github.com/apache/iceberg/issues/3859


   Structed Streaming read iceberg table will report NullPointerException when 
iceberg table was expired snapshot.
   public StreamingOffset initialOffset() {
       InputFile inputFile = this.io.newInputFile(this.initialOffsetLocation);
       if (inputFile.exists()) {
           return this.readOffset(inputFile);
       } else {
           this.table.refresh();
           StreamingOffset offset = this.table.currentSnapshot() == null ? 
StreamingOffset.START_OFFSET : new 
StreamingOffset(SnapshotUtil.oldestSnapshot(this.table).snapshotId(), 0L, 
false);
           OutputFile outputFile = 
this.io.newOutputFile(this.initialOffsetLocation);
           this.writeOffset(offset, outputFile);
           return offset;
       }
   }
   
   public static Snapshot oldestSnapshot(Table table) {
       Snapshot current;
       for(current = table.currentSnapshot(); current != null && 
current.parentId() != null; current = table.snapshot(current.parentId())) {
       return current;
   }
   
   parentId exists while the meta and data file was deleted, i'd like to fix 
code like this:
   StreamingOffset offset = this.table.currentSnapshot() == null ? 
StreamingOffset.START_OFFSET : this.table.currentSnapshot();
   
   @SreeramGarlapati
   
   
   


-- 
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