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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java:
##########
@@ -190,6 +190,19 @@ private PaimonSnapshotCacheValue 
getPaimonSnapshotCacheValue(Optional<TableSnaps
                         "Failed to get Paimon snapshot: " + (e.getMessage() == 
null ? "unknown cause" : e.getMessage()),
                         e);
             }
+        } else if (scanParams.isPresent() && scanParams.get().isOptions()) {
+            Table baseTable = getBasePaimonTable();
+            Map<String, String> resolvedOptions = 
scanParams.get().getOrResolveMapParams(
+                    options -> PaimonScanParams.resolveOptions(baseTable, 
options));
+            Table effectiveTable = PaimonScanParams.applyOptions(baseTable, 
resolvedOptions);
+            if (PaimonScanParams.hasOnlyReaderOptions(resolvedOptions)) {
+                // Reader tuning cannot change snapshot metadata. Reuse the 
memoized projection so
+                // a per-query batch-size change does not enumerate every 
partition again.
+                return PaimonUtils.getLatestSnapshotCacheValue(this);
+            }
+            // The shared latest cache was built from the catalog-scoped 
handle. Relation options
+            // need their own projection so partition enumeration uses the 
final safe table copy.
+            return PaimonUtils.loadSnapshotProjection(this, effectiveTable);

Review Comment:
   [P1] Keep the resolved tag as the projection's only startup selector. For 
`scan.tag-name` (and a tag-valued `scan.version`), 
`resolveOptions`/`applyOptions` leave `scan.tag-name` on `effectiveTable`. This 
latest-only loader then preserves that option through `copyWithLatestSchema()` 
and adds `scan.snapshot-id` via `copyWithoutTimeTravel()`. Paimon validates the 
merged table with both selectors and rejects FROM_SNAPSHOT because exactly one 
selector is allowed, so `StatementContext.loadSnapshots` fails before scan 
planning, even for unpartitioned tables. Please build the statement projection 
from the selected tag (or otherwise clear inherited selectors atomically before 
repinning), and cover this path with a real `FileStoreTable` rather than a 
mocked projection loader.



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