@@ -73,7 +73,6 @@ public class IcebergMigrator implements Migrator {
73
73
private final ThreadPoolExecutor executor ;
74
74
75
75
private final Catalog paimonCatalog ;
76
- private final FileIO paimonFileIO ;
77
76
private final String paimonDatabaseName ;
78
77
private final String paimonTableName ;
79
78
@@ -100,7 +99,6 @@ public IcebergMigrator(
100
99
Options icebergOptions ,
101
100
Integer parallelism ) {
102
101
this .paimonCatalog = paimonCatalog ;
103
- this .paimonFileIO = paimonCatalog .fileIO ();
104
102
this .paimonDatabaseName = paimonDatabaseName ;
105
103
this .paimonTableName = paimonTableName ;
106
104
@@ -126,9 +124,7 @@ public IcebergMigrator(
126
124
127
125
icebergMigrateMetadata =
128
126
icebergMigrateMetadataFactory .create (
129
- Identifier .create (icebergDatabaseName , icebergTableName ),
130
- paimonFileIO ,
131
- icebergOptions );
127
+ Identifier .create (icebergDatabaseName , icebergTableName ), icebergOptions );
132
128
133
129
this .icebergMetadata = icebergMigrateMetadata .icebergMetadata ();
134
130
this .icebergLatestMetadataLocation = icebergMigrateMetadata .icebergLatestMetadataLocation ();
@@ -148,6 +144,7 @@ public void executeMigrate() throws Exception {
148
144
149
145
try {
150
146
FileStoreTable paimonTable = (FileStoreTable ) paimonCatalog .getTable (paimonIdentifier );
147
+ FileIO fileIO = paimonTable .fileIO ();
151
148
152
149
IcebergManifestFile manifestFile =
153
150
IcebergManifestFile .create (paimonTable , icebergMetaPathFactory );
@@ -214,8 +211,8 @@ public void executeMigrate() throws Exception {
214
211
for (Map .Entry <Path , Path > entry : rollback .entrySet ()) {
215
212
Path newPath = entry .getKey ();
216
213
Path origin = entry .getValue ();
217
- if (paimonFileIO .exists (newPath )) {
218
- paimonFileIO .rename (newPath , origin );
214
+ if (fileIO .exists (newPath )) {
215
+ fileIO .rename (newPath , origin );
219
216
}
220
217
}
221
218
@@ -331,8 +328,7 @@ private MigrateTask importUnPartitionedTable(
331
328
BinaryRow partitionRow = BinaryRow .EMPTY_ROW ;
332
329
Path newDir = paimonTable .store ().pathFactory ().bucketPath (partitionRow , 0 );
333
330
334
- return new MigrateTask (
335
- icebergDataFileMetas , paimonFileIO , paimonTable , partitionRow , newDir , rollback );
331
+ return new MigrateTask (icebergDataFileMetas , paimonTable , partitionRow , newDir , rollback );
336
332
}
337
333
338
334
private List <MigrateTask > importPartitionedTable (
@@ -347,13 +343,7 @@ private List<MigrateTask> importPartitionedTable(
347
343
BinaryRow partitionRow = entry .getKey ();
348
344
Path newDir = paimonTable .store ().pathFactory ().bucketPath (partitionRow , 0 );
349
345
migrateTasks .add (
350
- new MigrateTask (
351
- entry .getValue (),
352
- paimonFileIO ,
353
- paimonTable ,
354
- partitionRow ,
355
- newDir ,
356
- rollback ));
346
+ new MigrateTask (entry .getValue (), paimonTable , partitionRow , newDir , rollback ));
357
347
}
358
348
return migrateTasks ;
359
349
}
@@ -362,21 +352,18 @@ private List<MigrateTask> importPartitionedTable(
362
352
public static class MigrateTask implements Callable <CommitMessage > {
363
353
364
354
private final List <IcebergDataFileMeta > icebergDataFileMetas ;
365
- private final FileIO fileIO ;
366
355
private final FileStoreTable paimonTable ;
367
356
private final BinaryRow partitionRow ;
368
357
private final Path newDir ;
369
358
private final Map <Path , Path > rollback ;
370
359
371
360
public MigrateTask (
372
361
List <IcebergDataFileMeta > icebergDataFileMetas ,
373
- FileIO fileIO ,
374
362
FileStoreTable paimonTable ,
375
363
BinaryRow partitionRow ,
376
364
Path newDir ,
377
365
Map <Path , Path > rollback ) {
378
366
this .icebergDataFileMetas = icebergDataFileMetas ;
379
- this .fileIO = fileIO ;
380
367
this .paimonTable = paimonTable ;
381
368
this .partitionRow = partitionRow ;
382
369
this .newDir = newDir ;
@@ -385,6 +372,7 @@ public MigrateTask(
385
372
386
373
@ Override
387
374
public CommitMessage call () throws Exception {
375
+ FileIO fileIO = paimonTable .fileIO ();
388
376
if (!fileIO .exists (newDir )) {
389
377
fileIO .mkdirs (newDir );
390
378
}
0 commit comments