github-actions[bot] commented on code in PR #67348:
URL: https://github.com/apache/doris/pull/67348#discussion_r4255840893
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateCommand.java:
##########
@@ -197,7 +198,9 @@ public LogicalPlan completeQueryPlan(ConnectContext ctx,
LogicalPlan logicalQuer
break;
}
}
- if (column.isKey() || existInExpr) {
+ boolean isGeneratedColumnDependency =
column.getGeneratedColumnInfo() == null
+ &&
CollectionUtils.isNotEmpty(column.getGeneratedColumnsThatReferToThis());
+ if (column.isKey() || existInExpr ||
isGeneratedColumnDependency) {
Review Comment:
[P1] Preserve ON UPDATE expressions for added dependencies
An unassigned dependency keeps the `UnboundSlot` created above. For a MoW
UNIQUE KEY(id) table with `id INT, ts DATETIME DEFAULT CURRENT_TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP, g INT AS (YEAR(ts)), v INT`, insert `ts='2000-01-01
00:00:00'` and run `UPDATE t SET v=999 WHERE id=1`. This takes the
partial-update path, and the new projection now supplies the old `ts`
explicitly:
```text
UnboundTableSink[id, ts, v]
Project[id, ts_old, 999]
Filter[id = 1]
Scan[t]
```
`BindSink.getColumnToOutput` takes its explicit-column branch for `ts`
before the omitted-column `hasOnUpdateDefaultValue()` branch, then computes
`g=YEAR(ts_old)`. The write succeeds but leaves `ts` at the historical
timestamp and `g=2000`; before this change, omitting `ts` let BindSink evaluate
CURRENT_TIMESTAMP and derive the current year. For unassigned dependencies,
preserve the ON UPDATE expression (as the full-update projection does), or
leave such columns for BindSink to supply. Add a regression covering both
automatically updated values.
--
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]