morningman commented on code in PR #71125:
URL: https://github.com/apache/doris/pull/71125#discussion_r4735429915


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/mvcc/PluginDrivenMvccExternalTable.java:
##########
@@ -532,15 +533,20 @@ private MvccSnapshot loadSnapshotInternal(
                             latestSnapshotFence.get()).getConnectorSnapshot()))
                     : materializeLatest();
         }
-        // Mutual exclusion — parity with legacy 
PaimonScanNode.getProcessedTable:891-892.
-        if (tableSnapshot.isPresent() && scanParams.isPresent()) {
-            throw new RuntimeException("Can not specify scan params and table 
snapshot at same time.");
-        }
-        ConnectorTimeTravelSpec spec = toTimeTravelSpec(tableSnapshot, 
scanParams, latestSnapshotFence);
-
         makeSureInitialized();
         PluginDrivenExternalCatalog pluginCatalog = 
(PluginDrivenExternalCatalog) catalog;
         Connector connector = pluginCatalog.getConnector();
+        boolean snapshotInBranch = tableSnapshot.isPresent() && 
scanParams.isPresent();
+        // Mutual exclusion — parity with legacy 
PaimonScanNode.getProcessedTable:891-892 — except for a version
+        // or a time inside an @branch, which a connector declaring 
SUPPORTS_BRANCH_TIME_TRAVEL resolves on the
+        // branch's own chain. Any other connector would read its main chain 
instead.
+        if (snapshotInBranch && (!scanParams.get().isBranch()
+                || 
!connector.getCapabilities().contains(ConnectorCapability.SUPPORTS_BRANCH_TIME_TRAVEL)))
 {
+            throw new RuntimeException("Can not specify scan params and table 
snapshot at same time.");
+        }
+        ConnectorTimeTravelSpec unqualified = toTimeTravelSpec(tableSnapshot, 
scanParams, latestSnapshotFence);
+        ConnectorTimeTravelSpec spec = snapshotInBranch
+                ? 
unqualified.withinBranch(extractBranchOrTagName(scanParams.get())) : 
unqualified;

Review Comment:
   Done in bd77726745f: a spec resolved inside an `@branch` now gets `... in 
branch <name>` (`can't find snapshot by id: 9 in branch dev`), covered by 
`testNotFoundTranslationNamesTheBranchASnapshotWasResolvedIn`. As you say, 
Lance raises its own errors, so no current connector reaches this message.
   



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