caiconghui commented on a change in pull request #4006: URL: https://github.com/apache/incubator-doris/pull/4006#discussion_r462418665
########## File path: be/src/olap/olap_cond.cpp ########## @@ -176,6 +150,14 @@ OLAPStatus Cond::init(const TCondition& tcond, const TabletColumn& column) { tcond.column_name.c_str(), operand.c_str(), op); return res; } + if (min_value_field == nullptr || f->cmp(min_value_field) > 0) { Review comment: my bad, I will fix it A->cmp(B) > 0 means A > B ########## File path: be/src/olap/olap_cond.h ########## @@ -87,11 +88,13 @@ struct Cond { } CondOp op; - // valid when op is not OP_IN + // valid when op is not OP_IN and OP_NOT_IN WrapperField* operand_field; - // valid when op is OP_IN + // valid when op is OP_IN or OP_NOT_IN typedef std::unordered_set<const WrapperField*, FieldHash, FieldEqual> FieldSet; FieldSet operand_set; + WrapperField* min_value_field; Review comment: done ########## File path: fe/fe-core/src/main/java/org/apache/doris/load/DeleteHandler.java ########## @@ -507,7 +516,19 @@ private void checkDeleteV2(OlapTable table, Partition partition, List<Predicate> LiteralExpr.create(value, Type.fromPrimitiveType(column.getDataType())); } catch (AnalysisException e) { // ErrorReport.reportDdlException(ErrorCode.ERR_INVALID_VALUE, value); - throw new DdlException("Invalid column value[" + value + "]"); + throw new DdlException("Invalid column value[" + value + "] for column " + columnName); + } + } else if (condition instanceof InPredicate) { + String value = null; + try { + InPredicate inPredicate = (InPredicate) condition; + for (int i = 1; i <= inPredicate.getInElementNum(); i++) { + value = ((LiteralExpr) inPredicate.getChild(i)).getStringValue(); + LiteralExpr.create(value, Type.fromPrimitiveType(column.getDataType())); + } + } catch (AnalysisException e) { + // ErrorReport.reportDdlException(ErrorCode.ERR_INVALID_VALUE, value); Review comment: done ########## File path: be/src/olap/olap_cond.cpp ########## @@ -210,19 +192,19 @@ bool Cond::eval(const RowCursorCell& cell) const { case OP_GE: return operand_field->field()->compare_cell(*operand_field, cell) <= 0; case OP_IN: { - for (const WrapperField* field : operand_set) { - if (field->field()->compare_cell(*field, cell) == 0) { - return true; - } - } - return false; + WrapperField wrapperField(const_cast<Field *> (min_value_field->field()), cell); + auto ret = operand_set.find(&wrapperField) != operand_set.end(); + wrapperField.release_field(); + return ret; + } + case OP_NOT_IN: { Review comment: one is "!=", the other is "==" ########## File path: be/src/olap/olap_cond.cpp ########## @@ -210,19 +192,19 @@ bool Cond::eval(const RowCursorCell& cell) const { case OP_GE: return operand_field->field()->compare_cell(*operand_field, cell) <= 0; case OP_IN: { - for (const WrapperField* field : operand_set) { - if (field->field()->compare_cell(*field, cell) == 0) { - return true; - } - } - return false; + WrapperField wrapperField(const_cast<Field *> (min_value_field->field()), cell); + auto ret = operand_set.find(&wrapperField) != operand_set.end(); + wrapperField.release_field(); + return ret; + } + case OP_NOT_IN: { Review comment: one is "!="(line 196), the other is "=="(line 202) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org