This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 2ebf871c0cb branch-3.0 [fix](delete) fix insert into cols should be
corresponding to the query output for delete from command #47406 (#47454)
2ebf871c0cb is described below
commit 2ebf871c0cba67ff5d2dad44a6d996f2bbb06158
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Jan 26 20:24:32 2025 +0800
branch-3.0 [fix](delete) fix insert into cols should be corresponding to
the query output for delete from command #47406 (#47454)
Cherry-picked from #47406
Co-authored-by: meiyi <[email protected]>
---
.../trees/plans/commands/DeleteFromCommand.java | 3 +-
.../delete/delete_mow_partial_update.out | Bin 887 -> 1148 bytes
.../delete/delete_mow_partial_update.groovy | 45 +++++++++++++++++++++
3 files changed, 47 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromCommand.java
index 34a54ec2651..8cc5135af86 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromCommand.java
@@ -408,7 +408,8 @@ public class DeleteFromCommand extends Command implements
ForwardWithSync, Expla
expr = new UnboundAlias(new TinyIntLiteral(((byte) 1)),
Column.DELETE_SIGN);
} else if (column.getName().equalsIgnoreCase(Column.SEQUENCE_COL)
&& targetTable.getSequenceMapCol() != null) {
- expr = new UnboundSlot(tableName,
targetTable.getSequenceMapCol());
+ expr = new UnboundAlias(new UnboundSlot(tableName,
targetTable.getSequenceMapCol()),
+ Column.SEQUENCE_COL);
} else if (column.isKey()) {
expr = new UnboundSlot(tableName, column.getName());
} else if (!isMow && (!column.isVisible() ||
(!column.isAllowNull() && !column.hasDefaultValue()))) {
diff --git
a/regression-test/data/nereids_p0/delete/delete_mow_partial_update.out
b/regression-test/data/nereids_p0/delete/delete_mow_partial_update.out
index 54b9aa4cee9..1a090023156 100644
Binary files
a/regression-test/data/nereids_p0/delete/delete_mow_partial_update.out and
b/regression-test/data/nereids_p0/delete/delete_mow_partial_update.out differ
diff --git
a/regression-test/suites/nereids_p0/delete/delete_mow_partial_update.groovy
b/regression-test/suites/nereids_p0/delete/delete_mow_partial_update.groovy
index a03a9a92fa7..680b26a4e4a 100644
--- a/regression-test/suites/nereids_p0/delete/delete_mow_partial_update.groovy
+++ b/regression-test/suites/nereids_p0/delete/delete_mow_partial_update.groovy
@@ -146,4 +146,49 @@ suite('nereids_delete_mow_partial_update') {
sql "drop table if exists ${tableName3};"
}
}
+
+ def tableName = "nereids_delete_mow_partial_update10"
+ sql "DROP TABLE IF EXISTS ${tableName};"
+ sql """
+ CREATE TABLE ${tableName} (
+ `l_shipdate` date NOT NULL,
+ `l_orderkey` bigint NOT NULL,
+ `l_linenumber` bigint NOT NULL,
+ `l_partkey` bigint NOT NULL,
+ `l_suppkey` bigint NOT NULL,
+ `l_quantity` decimal(15,2) NOT NULL,
+ `l_extendedprice` decimal(15,2) NOT NULL,
+ `l_discount` decimal(15,2) NOT NULL,
+ `l_tax` decimal(15,2) NOT NULL,
+ `l_returnflag` varchar(1) NOT NULL,
+ `l_linestatus` varchar(1) NOT NULL,
+ `l_commitdate` date NOT NULL,
+ `l_receiptdate` date NOT NULL,
+ `l_shipinstruct` varchar(25) NOT NULL,
+ `l_shipmode` varchar(10) NOT NULL,
+ `l_comment` varchar(44) NOT NULL
+ )
+ UNIQUE KEY(`l_shipdate`, `l_orderkey`, `l_linenumber`, `l_partkey`,
`l_suppkey`)
+ DISTRIBUTED BY HASH(`l_orderkey`) BUCKETS 1
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1",
+ "enable_unique_key_merge_on_write" = "true",
+ "function_column.sequence_col" = "l_Shipdate"
+ );
+ """
+ sql """
+ insert into ${tableName} values
+ ('2023-12-09', 1, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k',
'2023-12-09', '2023-12-10', 'a', 'b', 'yyyyyyyyy'),
+ ('2023-12-09', 2, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k',
'2023-12-09', '2023-12-10', 'a', 'b', 'yyyyyyyyy') ;
+ """
+ explain {
+ sql """ delete from ${tableName} where l_orderkey = 800; """
+ contains "IS_PARTIAL_UPDATE: true"
+ }
+ sql """ delete from ${tableName} where l_orderkey = 800; """
+ sql "sync"
+ order_qt_sql """ SELECT * FROM ${tableName}; """
+ sql """ delete from ${tableName} where l_orderkey = 2; """
+ sql "sync"
+ order_qt_sql """ SELECT * FROM ${tableName}; """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]