@@ -234,8 +234,7 @@ protected void registerIcebergTable(TableMetadata srcMetadata, TableMetadata dst
234234 *
235235 * @param icebergPartitionFilterPredicate the predicate to filter partitions
236236 * @return a list of data files that match the partition filter predicate
237- * @throws TableNotFoundException if error occurred while accessing the table metadata
238- * @throws RuntimeException if error occurred while reading the manifest file
237+ * @throws IOException if error occurred while accessing the table metadata or reading the manifest file
239238 */
240239 public List <DataFile > getPartitionSpecificDataFiles (Predicate <StructLike > icebergPartitionFilterPredicate )
241240 throws IOException {
@@ -286,7 +285,13 @@ protected void overwritePartition(List<DataFile> dataFiles, String partitionColN
286285 if (dataFiles .isEmpty ()) {
287286 return ;
288287 }
289- log .info ("~{}~ SnapshotId before overwrite: {}" , tableId , accessTableMetadata ().currentSnapshot ().snapshotId ());
288+ TableMetadata tableMetadata = accessTableMetadata ();
289+ Optional <Snapshot > currentSnapshot = Optional .ofNullable (tableMetadata .currentSnapshot ());
290+ if (currentSnapshot .isPresent ()) {
291+ log .info ("~{}~ SnapshotId before overwrite: {}" , tableId , currentSnapshot .get ().snapshotId ());
292+ } else {
293+ log .warn ("~{}~ No current snapshot found before overwrite" , tableId );
294+ }
290295 OverwriteFiles overwriteFiles = this .table .newOverwrite ();
291296 overwriteFiles .overwriteByRowFilter (Expressions .equal (partitionColName , partitionValue ));
292297 dataFiles .forEach (overwriteFiles ::addFile );
0 commit comments