[pick](Variant) pick some refactor and fix #34925 #36317 #36201 #36793 (#37526)

This commit is contained in:
lihangyu
2024-07-11 21:25:34 +08:00
committed by GitHub
parent cf2fb6945a
commit 217eac790b
41 changed files with 678 additions and 431 deletions

View File

@ -191,12 +191,8 @@ 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)) {
@ -204,13 +200,10 @@ public class UpdateStmt extends DdlStmt {
}
}
}
// 1.table with sequence col cannot use partial update cause in MOW, we encode pk
// 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
&& !hasVariant) {
&& setExprCnt <= targetTable.getColumns().size() * 3 / 10) {
isPartialUpdate = true;
}
Optional<Column> sequenceMapCol = Optional.empty();

View File

@ -159,7 +159,7 @@ public class UpdateCommand extends Command implements ForwardWithSync, Explainab
boolean isPartialUpdate = targetTable.getEnableUniqueKeyMergeOnWrite()
&& selectItems.size() < targetTable.getColumns().size()
&& !targetTable.hasVariantColumns() && targetTable.getSequenceCol() == null
&& targetTable.getSequenceCol() == null
&& partialUpdateColNameToExpression.size() <= targetTable.getFullSchema().size() * 3 / 10;
List<String> partialUpdateColNames = new ArrayList<>();