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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/execute/ConnectorRewriteGroupTask.java:
##########
@@ -268,6 +273,8 @@ private ConnectContext buildConnectContext() {
         StatementContext statementContext = new StatementContext();
         statementContext.setConnectContext(taskContext);
         taskContext.setStatementContext(statementContext);
+        operationSnapshot.ifPresent(snapshot ->
+                statementContext.setSnapshot(new MvccTableInfo(dorisTable), 
snapshot));

Review Comment:
   [P1] Fence the rewrite sink against the operation's schema
   
   Installing the old schema here does not pin the write schema: 
`BindSink.bindConnectorTableSink()` calls `getWriteSchemaSnapshot()` (an 
explicit latest lookup), and `selectConnectorRewriteOutputs()` matches source 
slots by name. If Iceberg drops `a` (field 2) and adds a nullable `a INT` 
(field 3) after the operation pin, then latest metadata is refreshed before a 
group binds, the reduced plan is:
   
   ```text
   RewriteSink(a, field 3)
     Project(a, field 2)
       Scan(operation schema)
   ```
   
   The source reads the old values, while `IcebergWritePlanProvider` validates 
only the latest target columns and writes current schema JSON. These 
schema-only commits leave the data snapshot unchanged, so the new snapshot 
checks and commit validation pass, replacing the new field's expected 
NULL/default with the dropped field's values. Bind the rewrite source and sink 
to consistent field identities, or reject schema-generation drift before 
writing; cover this with a source-to-sink drop/re-add regression.



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