Gabriel39 commented on code in PR #66247:
URL: https://github.com/apache/doris/pull/66247#discussion_r3690589009
##########
fe/fe-connector/fe-connector-paimon/src/main/java/org/apache/doris/connector/paimon/PaimonConnectorMetadata.java:
##########
@@ -749,7 +767,10 @@ public Optional<ConnectorMvccSnapshot> resolveTimeTravel(
.properties(PaimonScanParams.markAsOptions(resolved))
.build());
}
- long pinnedId = pinnedSnapshotId(table, resolved);
+ long pinnedId = spec.getLatestSnapshotFence().isPresent()
Review Comment:
Valid. Commit bd46e1fa6c1 keeps schemaId unset for planning-only options
derived from the statement fence, preserving latest-schema semantics.
##########
fe/fe-connector/fe-connector-paimon/src/main/java/org/apache/doris/connector/paimon/PaimonScanParams.java:
##########
@@ -336,6 +350,16 @@ private static Map<String, String> resolvedSnapshotOptions(
return resolved;
}
+ public static Map<String, String> pinOptionsToSnapshot(
+ Map<String, String> options, long snapshotId) {
+ // Statement-fence pinning removes inherited selectors, so validate
the raw map first;
+ // otherwise an unsupported inherited key can disappear before the
common validation path.
+ validateOptions(options);
+ return snapshotId < 0
Review Comment:
Valid. Commit bd46e1fa6c1 carries an internal empty-fence marker through
plain and OPTIONS paths, and split plus partition planning honor it.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/mvcc/PluginDrivenMvccExternalTable.java:
##########
@@ -347,15 +355,71 @@ private static ListPartitionItem
toListPartitionItem(String partitionName, List<
@Override
public MvccSnapshot loadSnapshot(Optional<TableSnapshot> tableSnapshot,
Optional<TableScanParams> scanParams) {
+ return loadSnapshotInternal(tableSnapshot, scanParams,
Optional.empty());
+ }
+
+ @Override
+ public MvccSnapshot loadLatestSnapshotFence() {
+ makeSureInitialized();
+ PluginDrivenExternalCatalog pluginCatalog =
(PluginDrivenExternalCatalog) catalog;
+ Connector connector = pluginCatalog.getConnector();
+ if (connector == null) {
+ return new PluginDrivenMvccSnapshot(emptySnapshot(),
+ Collections.emptyMap(), Collections.emptyMap());
+ }
+ ConnectorSession session = pluginCatalog.buildConnectorSession();
+ ConnectorMetadata metadata = PluginDrivenMetadata.get(session,
connector);
+ Optional<ConnectorTableHandle> handle =
resolveConnectorTableHandle(session, metadata);
+ ConnectorMvccSnapshot fence = handle.isPresent()
+ ? metadata.beginQuerySnapshot(session,
handle.get()).orElseGet(this::emptySnapshot)
+ : emptySnapshot();
+ // A fence carries version identity only; raw partitions may be
invalid for relation options.
+ return new PluginDrivenMvccSnapshot(fence, Collections.emptyMap(),
Collections.emptyMap());
+ }
+
+ @Override
+ public boolean requiresLatestSnapshotFence(
+ Optional<TableSnapshot> tableSnapshot, Optional<TableScanParams>
scanParams) {
+ if (tableSnapshot.isPresent() || !scanParams.isPresent() ||
!scanParams.get().isOptions()) {
+ return false;
+ }
+ makeSureInitialized();
+ PluginDrivenExternalCatalog pluginCatalog =
(PluginDrivenExternalCatalog) catalog;
+ Connector connector = pluginCatalog.getConnector();
+ if (connector == null) {
+ return false;
+ }
+ ConnectorSession session = pluginCatalog.buildConnectorSession();
+ ConnectorMetadata metadata = PluginDrivenMetadata.get(session,
connector);
+ Optional<ConnectorTableHandle> handle =
resolveConnectorTableHandle(session, metadata);
+ return handle.isPresent() && metadata.usesStatementSnapshotForOptions(
+ session, handle.get(), scanParams.get().getMapParams());
+ }
+
+ @Override
+ public MvccSnapshot loadSnapshot(
Review Comment:
Valid. Commit bd46e1fa6c1 routes the system table source through the
StatementContext fence while preserving the relation memo.
--
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]