rdblue commented on a change in pull request #543: Avoid NullPointerException 
in FindFiles when there is no snapshot
URL: https://github.com/apache/incubator-iceberg/pull/543#discussion_r336111263
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/FindFiles.java
 ##########
 @@ -191,7 +191,10 @@ public Builder inPartitions(PartitionSpec spec, 
List<StructLike> partitions) {
       Snapshot snapshot = snapshotId != null ?
           ops.current().snapshot(snapshotId) : ops.current().currentSnapshot();
 
-      CloseableIterable<ManifestEntry> entries = new ManifestGroup(ops, 
snapshot.manifests())
+      // snapshot could be null when the table just gets created
+      Iterable<ManifestFile> manifests = (snapshot != null) ? 
snapshot.manifests() : CloseableIterable.empty();
+
+      CloseableIterable<ManifestEntry> entries = new ManifestGroup(ops, 
manifests)
 
 Review comment:
   If there are no manifests, then entries should be 
`CloseableIterable.empty()`, not the manifest iterable. That doesn't need to be 
closeable.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to