This is an automated email from the ASF dual-hosted git repository. jianliangqi pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new cc9b4bcddbe [Fix](variant) fallback to none partial update for mow table (#28116) cc9b4bcddbe is described below commit cc9b4bcddbe210da74e2d634160e216924a67360 Author: lihangyu <15605149...@163.com> AuthorDate: Thu Dec 7 19:30:24 2023 +0800 [Fix](variant) fallback to none partial update for mow table (#28116) --- .../src/main/java/org/apache/doris/analysis/UpdateStmt.java | 11 +++++++++-- regression-test/data/variant_p0/delete_update.out | 6 ++++++ regression-test/suites/variant_p0/delete_update.groovy | 11 ++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/UpdateStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/UpdateStmt.java index c3afcca68a3..08e755b35ce 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/UpdateStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/UpdateStmt.java @@ -189,8 +189,12 @@ public class UpdateStmt extends DdlStmt { // step3: generate select list and insert column name list in insert stmt boolean isMow = ((OlapTable) targetTable).getEnableUniqueKeyMergeOnWrite(); + boolean hasVariant = false; int setExprCnt = 0; for (Column column : targetTable.getColumns()) { + if (column.getType().isVariantType()) { + hasVariant = true; + } for (BinaryPredicate setExpr : setExprs) { Expr lhs = setExpr.getChild(0); if (((SlotRef) lhs).getColumn().equals(column)) { @@ -198,10 +202,13 @@ public class UpdateStmt extends DdlStmt { } } } - // table with sequence col cannot use partial update cause in MOW, we encode pk + // 1.table with sequence col cannot use partial update cause in MOW, we encode pk // with seq column but we don't know which column is sequence in update + // 2. variant column update schema during load, so implement partial update is complicated, + // just ignore it at present if (isMow && ((OlapTable) targetTable).getSequenceCol() == null - && setExprCnt <= targetTable.getColumns().size() * 3 / 10) { + && setExprCnt <= targetTable.getColumns().size() * 3 / 10 + && !hasVariant) { isPartialUpdate = true; } for (Column column : targetTable.getColumns()) { diff --git a/regression-test/data/variant_p0/delete_update.out b/regression-test/data/variant_p0/delete_update.out index be66efb82e0..6f4eb1123fb 100644 --- a/regression-test/data/variant_p0/delete_update.out +++ b/regression-test/data/variant_p0/delete_update.out @@ -7,4 +7,10 @@ -- !sql -- 2 {"updated_value":123} {"updated_value":123} +6 {"c":4.0,"a":4,"b":[4]} {"updated_value" : 123} +7 {"updated_value":1111} yyy + +-- !sql -- +2 {"updated_value":123} {"updated_value":123} +6 {"c":4.0,"a":4,"b":[4]} {"updated_value" : 123} diff --git a/regression-test/suites/variant_p0/delete_update.groovy b/regression-test/suites/variant_p0/delete_update.groovy index 3b9e90c0c29..14dc0c1a686 100644 --- a/regression-test/suites/variant_p0/delete_update.groovy +++ b/regression-test/suites/variant_p0/delete_update.groovy @@ -55,9 +55,14 @@ suite("regression_test_variant_delete_and_update", "variant_type"){ sql "insert into var_delete_update_mow select k, cast(v as string), cast(v as string) from var_delete_update" sql "delete from ${table_name} where k = 1" sql "delete from ${table_name} where k in (select k from var_delete_update_mow where k in (3, 4, 5))" - // FIXME - // sql """update ${table_name} set vs = '{"updated_value" : 123}' where k = 2""" - // sql """update ${table_name} set v = '{"updated_value" : 123}' where k = 2""" + + sql """insert into ${table_name} values (6, '{"a" : 4, "b" : [4], "c": 4.0}', 'xxx')""" + sql """insert into ${table_name} values (7, '{"a" : 4, "b" : [4], "c": 4.0}', 'yyy')""" + sql """update ${table_name} set vs = '{"updated_value" : 123}' where k = 6""" + sql """update ${table_name} set v = '{"updated_value" : 1111}' where k = 7""" + qt_sql "select * from ${table_name} order by k" + + sql """delete from ${table_name} where vs = 'xxx' or vs = 'yyy'""" qt_sql "select * from ${table_name} order by k" // delete & insert concurrently --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org