@@ -83,8 +83,7 @@ public PartitionBucketMapping(
8383 * <p>For partitioned tables, the method reads {@link
8484 * org.apache.paimon.manifest.PartitionEntry}s, which aggregate manifest entries per partition
8585 * during the scan and therefore have a much smaller memory footprint than loading all data file
86- * entries. If the scan fails for any reason, a fallback mapping with only the default bucket
87- * count is returned.
86+ * entries. Any scan failure is propagated to the caller.
8887 *
8988 * @param table the {@link FileStoreTable} to load the mapping from
9089 * @return a {@link PartitionBucketMapping} reflecting the current bucket layout of the table
@@ -98,23 +97,21 @@ public static PartitionBucketMapping loadFromTable(FileStoreTable table) {
9897 }
9998
10099 public static PartitionBucketMapping loadFromScan (FileStoreScan scan , int defaultBuckets ) {
101- try {
102- List <PartitionEntry > partitionEntries = scan .readPartitionEntries ();
103- Map <BinaryRow , Integer > partitionBucketMap = new HashMap <>();
104- for (PartitionEntry entry : partitionEntries ) {
105- int totalBuckets = entry .totalBuckets ();
106- // Only store partitions whose bucket count differs from the default.
107- // This keeps the map empty for partitions that have never been rescaled,
108- // avoiding per-partition BinaryRow copies and Integer allocations entirely.
109- if (totalBuckets > 0 && totalBuckets != defaultBuckets ) {
110- partitionBucketMap .put (entry .partition ().copy (), totalBuckets );
111- }
112- }
113-
114- return new PartitionBucketMapping (defaultBuckets , partitionBucketMap );
115- } catch (Exception e ) {
100+ if (scan == null ) {
116101 return new PartitionBucketMapping (defaultBuckets , Collections .emptyMap ());
117102 }
103+ List <PartitionEntry > partitionEntries = scan .readPartitionEntries ();
104+ Map <BinaryRow , Integer > partitionBucketMap = new HashMap <>();
105+ for (PartitionEntry entry : partitionEntries ) {
106+ int totalBuckets = entry .totalBuckets ();
107+ // Only store partitions whose bucket count differs from the default.
108+ // This keeps the map empty for partitions that have never been rescaled,
109+ // avoiding per-partition BinaryRow copies and Integer allocations entirely.
110+ if (totalBuckets > 0 && totalBuckets != defaultBuckets ) {
111+ partitionBucketMap .put (entry .partition ().copy (), totalBuckets );
112+ }
113+ }
114+ return new PartitionBucketMapping (defaultBuckets , partitionBucketMap );
118115 }
119116
120117 /**
0 commit comments