Skip to content

Commit f489968

Browse files
author
xiaohongbo
committed
just ignore NotImplementedException to avoid failure caused by external paimon table
1 parent 5e59636 commit f489968

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

paimon-core/src/main/java/org/apache/paimon/catalog/CatalogUtils.java

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.apache.paimon.catalog;
2020

2121
import org.apache.paimon.CoreOptions;
22-
import org.apache.paimon.Snapshot;
2322
import org.apache.paimon.TableType;
2423
import org.apache.paimon.fs.FileIO;
2524
import org.apache.paimon.fs.Path;
@@ -325,18 +324,8 @@ private static List<Pair<Table, TableSnapshot>> toTableAndSnapshots(
325324
snapshot = optional.get();
326325
}
327326
} 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
340329
}
341330
}
342331
tableAndSnapshots.add(Pair.of(table, snapshot));
@@ -441,29 +430,4 @@ private static IcebergTable toIcebergTable(
441430
.comment(schema.comment())
442431
.build();
443432
}
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-
}
469433
}

0 commit comments

Comments
 (0)