Gabriel39 commented on code in PR #69545:
URL: https://github.com/apache/doris/pull/69545#discussion_r4359931126


##########
fe/fe-connector/fe-connector-paimon/src/main/java/org/apache/doris/connector/paimon/PaimonScanParams.java:
##########
@@ -204,13 +206,60 @@ public static Table applyOptions(Table table, Map<String, 
String> options) {
         }
         // Apply the relation override first, then normalize each physical 
planning branch. A
         // single combined copy would flatten independent fallback values into 
one sibling's cap.
-        Table effectiveTable = 
PaimonReaderOptions.runtimeSafeTable(table.copy(isolatedOptions));
+        Table effectiveTable = PaimonReaderOptions.runtimeSafeTable(
+                copyWithHistoricalSchema(table, isolatedOptions, options));
         // Validate after every copy so relation options participate in the 
documented
         // relation > catalog > physical precedence before the effective value 
is judged.
         PaimonReaderOptions.validateEffectiveTable(effectiveTable);
         return effectiveTable;
     }
 
+    static Table copyWithHistoricalSchema(Table table, Map<String, String> 
options) {
+        return copyWithHistoricalSchema(table, userOptions(options), options);
+    }
+
+    private static Table copyWithHistoricalSchema(
+            Table table, Map<String, String> dynamicOptions, Map<String, 
String> provenance) {
+        if (!(table instanceof FileStoreTable) || table instanceof 
ChainGroupReadTable
+                || PaimonTableDecorators.isChainTable(table)) {
+            // Chain groups have their own option filtering and are not 
ordinary fallback readers.
+            return table.copy(dynamicOptions);
+        }
+        if (table instanceof FallbackReadFileStoreTable) {
+            FallbackReadFileStoreTable pair = (FallbackReadFileStoreTable) 
table;
+            // Each branch has independent snapshot IDs. Keep the SDK's 
timestamp translation
+            // before restoring either schema; copying one historical schema 
onto the pair is invalid.
+            return PaimonTableDecorators.rebuildFallbackPair(pair,

Review Comment:
   Fixed in 61e929f7639. Historical field-option restoration now retains the 
resolved table's branch identity and primary/fallback policy, including removed 
keys. The restored options stay consistent with the pair's retained priority 
when manifest parallelism normalization rebuilds it.
   
   Added overlapping-partition tests at capacities 64 and 128, asserting both 
policy options and selected rows. Before the fix, capacity 64 returned backup 
value 20 while 128 returned main value 10; both now return main value 10. Full 
connector install and Checkstyle pass.
   



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