|
19 | 19 | package org.apache.paimon.catalog; |
20 | 20 |
|
21 | 21 | import org.apache.paimon.CoreOptions; |
22 | | -import org.apache.paimon.Snapshot; |
23 | 22 | import org.apache.paimon.TableType; |
24 | 23 | import org.apache.paimon.fs.FileIO; |
25 | 24 | import org.apache.paimon.fs.Path; |
@@ -325,18 +324,8 @@ private static List<Pair<Table, TableSnapshot>> toTableAndSnapshots( |
325 | 324 | snapshot = optional.get(); |
326 | 325 | } |
327 | 326 | } catch (Catalog.TableNotExistException ignored) { |
328 | | - } catch (NotImplementedException e) { |
329 | | - // does not support load external paimon table snapshot from rest server |
330 | | - // construct TableSnapshot from local snapshot and table scan |
331 | | - if (table instanceof FileStoreTable) { |
332 | | - FileStoreTable fileStoreTable = (FileStoreTable) table; |
333 | | - Snapshot lastSnapshot = table.latestSnapshot().orElse(null); |
334 | | - if (lastSnapshot != null) { |
335 | | - snapshot = tableSnapshotIdFromFileSystem(fileStoreTable, lastSnapshot); |
336 | | - } |
337 | | - } else { |
338 | | - throw new NotImplementedException(e.getMessage()); |
339 | | - } |
| 327 | + } catch (NotImplementedException ignored) { |
| 328 | + // does not support supportsVersionManagement for external paimon table |
340 | 329 | } |
341 | 330 | } |
342 | 331 | tableAndSnapshots.add(Pair.of(table, snapshot)); |
@@ -441,29 +430,4 @@ private static IcebergTable toIcebergTable( |
441 | 430 | .comment(schema.comment()) |
442 | 431 | .build(); |
443 | 432 | } |
444 | | - |
445 | | - private static TableSnapshot tableSnapshotIdFromFileSystem( |
446 | | - FileStoreTable fileStoreTable, Snapshot snapshot) { |
447 | | - Long totalRecordCount = snapshot.totalRecordCount(); |
448 | | - long recordCount = totalRecordCount != null ? totalRecordCount : 0L; |
449 | | - long fileSizeInBytes = 0L; |
450 | | - long fileCount = 0L; |
451 | | - long lastFileCreationTime = 0L; |
452 | | - |
453 | | - List<PartitionEntry> partitionEntries = |
454 | | - fileStoreTable.newSnapshotReader().withSnapshot(snapshot).partitionEntries(); |
455 | | - if (partitionEntries != null) { |
456 | | - for (PartitionEntry entry : partitionEntries) { |
457 | | - if (entry != null) { |
458 | | - fileSizeInBytes += entry.fileSizeInBytes(); |
459 | | - fileCount += entry.fileCount(); |
460 | | - lastFileCreationTime = |
461 | | - Math.max(lastFileCreationTime, entry.lastFileCreationTime()); |
462 | | - } |
463 | | - } |
464 | | - } |
465 | | - |
466 | | - return new TableSnapshot( |
467 | | - snapshot, recordCount, fileSizeInBytes, fileCount, lastFileCreationTime); |
468 | | - } |
469 | 433 | } |
0 commit comments