github-actions[bot] commented on code in PR #66717:
URL: https://github.com/apache/doris/pull/66717#discussion_r3796838716


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergSysExternalTable.java:
##########
@@ -178,19 +170,12 @@ private static long generateSysTableId(long 
sourceTableId, String sysTableType)
         return sourceTableId ^ (sysTableType.hashCode() * 31L);
     }
 
-    private SchemaCacheValue getOrCreateSchemaCacheValue() {
-        if (schemaCacheValue == null) {
-            synchronized (this) {
-                if (schemaCacheValue == null) {
-                    if (fullSchema == null) {
-                        fullSchema = 
IcebergUtils.parseSchema(getSysIcebergTable().schema(),
-                                getCatalog().getEnableMappingVarbinary(),
-                                getCatalog().getEnableMappingTimestampTz());
-                    }
-                    schemaCacheValue = new SchemaCacheValue(fullSchema);
-                }
-            }
-        }
-        return schemaCacheValue;
+    private SchemaCacheValue loadSchemaCacheValue() {
+        // Metadata-table schemas may change after source schema or 
partition-spec evolution.
+        // Resolve the schema from the same latest-generation path instead of 
permanently pairing
+        // this long-lived system-table object with its first observed 
generation.
+        return new 
SchemaCacheValue(IcebergUtils.parseSchema(getSysIcebergTable().schema(),

Review Comment:
   [P1] Bind the system-table schema to the relation snapshot
   
   `BindRelation` freezes the source-table snapshot, but 
`IcebergSysExternalTable` is not an `MvccTable`, so `LogicalFileScan` does not 
capture a schema from it. This line then reopens live latest for slots and 
`toThrift()`, while `IcebergScanNode` rebuilds snapshot-selectable tables such 
as `$partitions`, `$files`, and `$entries` from the earlier frozen base. A 
concurrent schema/spec evolution can therefore make analysis and execution use 
different metadata-table schemas. Please resolve and reuse the schema from the 
relation snapshot.



-- 
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