@@ -433,25 +433,23 @@ public WriterContainer<T> createWriterContainer(
433433 }
434434 }
435435
436- Snapshot latestSnapshot = snapshotManager .latestSnapshot ();
436+ Snapshot previousSnapshot = ignorePreviousFiles ? null : snapshotManager .latestSnapshot ();
437437 List <DataFileMeta > restoreFiles = new ArrayList <>();
438438 int totalBuckets ;
439- if (! ignorePreviousFiles && latestSnapshot != null ) {
440- totalBuckets = scanExistingFileMetas (latestSnapshot , partition , bucket , restoreFiles );
439+ if (previousSnapshot != null ) {
440+ totalBuckets = scanExistingFileMetas (previousSnapshot , partition , bucket , restoreFiles );
441441 } else {
442442 totalBuckets = getDefaultBucketNum (partition );
443443 }
444444
445445 IndexMaintainer <T > indexMaintainer =
446446 indexFactory == null
447447 ? null
448- : indexFactory .createOrRestore (
449- ignorePreviousFiles ? null : latestSnapshot , partition , bucket );
448+ : indexFactory .createOrRestore (previousSnapshot , partition , bucket );
450449 DeletionVectorsMaintainer deletionVectorsMaintainer =
451450 dvMaintainerFactory == null
452451 ? null
453- : dvMaintainerFactory .createOrRestore (
454- ignorePreviousFiles ? null : latestSnapshot , partition , bucket );
452+ : dvMaintainerFactory .createOrRestore (previousSnapshot , partition , bucket );
455453 RecordWriter <T > writer =
456454 createWriter (
457455 partition .copy (),
@@ -468,7 +466,7 @@ public WriterContainer<T> createWriterContainer(
468466 totalBuckets ,
469467 indexMaintainer ,
470468 deletionVectorsMaintainer ,
471- latestSnapshot == null ? null : latestSnapshot .id ());
469+ previousSnapshot == null ? null : previousSnapshot .id ());
472470 }
473471
474472 @ Override
0 commit comments