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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java:
##########
@@ -110,7 +110,9 @@ public Table getPaimonTable(Optional<MvccSnapshot> 
snapshot) {
     public Table getPaimonTable(TableScanParams scanParams) {
         if (scanParams != null && scanParams.isOptions()) {
             Map<String, String> options = scanParams.getMapParams();
-            Table statementTable = 
getPaimonTable(MvccUtil.getSnapshotFromContext(this));
+            // Resolve the snapshot pinned for this exact alias; another alias 
of the same table may
+            // carry different relation options and therefore a different 
statement snapshot.
+            Table statementTable = 
getPaimonTable(MvccUtil.getSnapshotFromContext(this, null, scanParams));

Review Comment:
   [P1] Do not re-resolve a mutable tag after binding. `loadSnapshots` has 
already resolved `scan.tag-name` (or a tag-valued `scan.version`) for this 
relation, but the canonical resolved map retains the tag name and the code 
below discards this `statementTable` for schema-selecting options, reopens 
`getBasePaimonTable()`, and applies that name again. Paimon's tag starting 
scanner looks up the tag when scan planning starts, so replacing or 
delete/recreating `stable` from S1 to S2 between binding and schema/split setup 
can bind S1 yet scan S2 (or fail after binding). Carry the already-selected tag 
snapshot artifact through schema and split planning, including supported system 
OPTIONS, and add a tag-replacement race test. This occurs after successful 
binding and is distinct from r3682658334's mixed-selector failure.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/source/PaimonScanNode.java:
##########
@@ -673,11 +703,12 @@ public List<org.apache.paimon.table.source.Split> 
getPaimonSplitFromAPI() throws
         long startTime = System.currentTimeMillis();
         try {
             Optional<MvccSnapshot> relationSnapshot = getRelationSnapshot();
-            if (relationSnapshot.isPresent() && relationSnapshot.get() 
instanceof PaimonMvccSnapshot
+            if (!(source.getExternalTable() instanceof PaimonSysExternalTable)

Review Comment:
   [P1] Keep the empty fence for data-dependent system tables. This condition 
exempts every `PaimonSysExternalTable`, including `$partitions`. An empty fence 
carries `INVALID_SNAPSHOT_ID` but no snapshot selector, and Paimon's partitions 
reader later calls `fileStoreTable.newScan().listPartitionEntries()` on that 
handle. If the first commit lands after binding but before reader creation, 
`$partitions` returns the new partition even though the statement was fenced 
while empty. Existing r3694727319 requires `$schemas`/`$options` to retain 
their data-independent rows; it does not justify bypassing the fence for 
source-data-dependent system tables. Gate the exemption by snapshot capability 
(and cover empty bind -> first commit for `$partitions`) instead of by wrapper 
class alone.



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