nastra commented on code in PR #14944:
URL: https://github.com/apache/iceberg/pull/14944#discussion_r2668096318


##########
core/src/main/java/org/apache/iceberg/SerializableTable.java:
##########
@@ -136,13 +144,20 @@ private Table lazyTable() {
     if (lazyTable == null) {
       synchronized (this) {
         if (lazyTable == null) {
-          if (metadataFileLocation == null) {
+          TableOperations ops;
+
+          if (tableMetadata != null) {
+            // Use serialized TableMetadata (tables requiring remote scan 
planning)
+            // This avoids storage access for distributed query planning
+            ops = new StaticTableOperations(tableMetadata, io, 
locationProvider());
+          } else if (metadataFileLocation != null) {
+            // Read from storage using metadata location
+            ops = new StaticTableOperations(metadataFileLocation, io, 
locationProvider());
+          } else {
             throw new UnsupportedOperationException(
-                "Cannot load metadata: metadata file location is null");
+                "Cannot load metadata: both tableMetadata and 
metadataFileLocation are null");

Review Comment:
   minor: I don't think we want to mention actual field names here, so it's 
probably better to keep the error msg more generic by just referring to table 
metadata / metadata file location



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to