diff --git a/src/share/object/ob_obj_cast.cpp b/src/share/object/ob_obj_cast.cpp index 0846f7ab3e..4be2259885 100644 --- a/src/share/object/ob_obj_cast.cpp +++ b/src/share/object/ob_obj_cast.cpp @@ -32,7 +32,6 @@ #include "sql/engine/expr/ob_expr_lob_utils.h" #include "lib/charset/ob_charset.h" #include "lib/geo/ob_geometry_cast.h" -#include "sql/engine/expr/ob_datum_cast.h" // from sql_parser_base.h #define DEFAULT_STR_LENGTH -1 @@ -12902,27 +12901,14 @@ int ObObjCaster::to_type(const ObExpectType &expect_type, const char OB_JSON_NULL[2] = {'\0', '\0'}; // binary json null -int ObObjCaster::get_zero_value(const ObObjType expect_type, - ObCollationType expect_cs_type, - uint64_t data_len, - ObIAllocator &alloc, - ObObj &zero_obj) +int ObObjCaster::get_zero_value(const ObObjType expect_type, ObCollationType expect_cs_type, ObObj &zero_obj) { int ret = OB_SUCCESS; ObObjCastParams params; //构造一个空的cast_param对象,适配SET_RES_XXX宏定义 ObCastMode cast_mode = CM_WARN_ON_FAIL; params.warning_ = 1; //将warning code设置为1,避免SET_RES_XXX宏将其当做真实的warning处理 - if (ob_is_string_tc(expect_type)) { - //zero_obj.set_string(expect_type, ""); - ObString padding_res; - if (ObVarcharType == expect_type) { - zero_obj.set_string(expect_type, ""); - } else if (OB_FAIL(sql::padding_char_for_cast(data_len, expect_cs_type, alloc, - padding_res))) { - LOG_WARN("padding char failed", K(ret), K(data_len), K(expect_cs_type)); - } else { - zero_obj.set_string(expect_type, padding_res); - } + if (ob_is_string_tc(expect_type) || ob_is_text_tc(expect_type)) { + zero_obj.set_string(expect_type, ""); } else if (ob_is_text_tc(expect_type)) { zero_obj.set_lob_value(expect_type, static_cast(NULL), 0); } else if (ob_is_int_tc(expect_type)) { diff --git a/src/share/object/ob_obj_cast.h b/src/share/object/ob_obj_cast.h index cfe2e9555a..94607dfba4 100644 --- a/src/share/object/ob_obj_cast.h +++ b/src/share/object/ob_obj_cast.h @@ -385,11 +385,7 @@ public: const ObObj &in_obj, ObObj &out_obj); static int to_type(const ObObjType expect_type, ObCollationType expect_cs_type, ObCastCtx &cast_ctx, const ObObj &in_obj, ObObj &out_obj); - static int get_zero_value(const ObObjType expect_type, - ObCollationType expect_cs_type, - uint64_t data_len, - ObIAllocator &alloc, - ObObj &zero_obj); + static int get_zero_value(const ObObjType expect_type, ObCollationType expect_cs_type, ObObj &zero_obj); static int enumset_to_inner(const ObObjMeta &expect_meta, const ObObj &in_obj, ObObj &out_obj, common::ObIAllocator &allocator, diff --git a/src/sql/engine/dml/ob_dml_service.cpp b/src/sql/engine/dml/ob_dml_service.cpp index c29da64fe6..0a4d7a0fd1 100644 --- a/src/sql/engine/dml/ob_dml_service.cpp +++ b/src/sql/engine/dml/ob_dml_service.cpp @@ -41,12 +41,11 @@ int ObDMLService::check_row_null(const ObExprPtrIArray &row, ObEvalCtx &eval_ctx, int64_t row_num, const ColContentIArray &column_infos, - const ObDASDMLBaseCtDef &das_ctdef, + bool is_ignore, bool is_single_value, ObTableModifyOp &dml_op) { int ret = OB_SUCCESS; - const bool is_ignore = das_ctdef.is_ignore_; ObSQLSessionInfo *session = NULL; CK(row.count() >= column_infos.count()); if (OB_ISNULL(session = dml_op.get_exec_ctx().get_my_session())) { @@ -74,10 +73,8 @@ int ObDMLService::check_row_null(const ObExprPtrIArray &row, } else if (OB_FAIL(ObObjCaster::get_zero_value( row.at(col_idx)->obj_meta_.get_type(), row.at(col_idx)->obj_meta_.get_collation_type(), - das_ctdef.column_accuracys_.at(i).get_length(), - eval_ctx.exec_ctx_.get_allocator(), zero_obj))) { - LOG_WARN("get column default zero value failed", K(ret), K(column_infos.at(i)), K(row.at(col_idx)->max_length_)); + LOG_WARN("get column default zero value failed", K(ret), K(column_infos.at(i))); } else if (OB_FAIL(ObTextStringResult::ob_convert_obj_temporay_lob(zero_obj, eval_ctx.exec_ctx_.get_allocator()))) { LOG_WARN("convert lob types zero obj failed", K(ret), K(zero_obj)); } else if (OB_FAIL(row_datum.from_obj(zero_obj))) { @@ -598,7 +595,7 @@ int ObDMLService::process_insert_row(const ObInsCtDef &ins_ctdef, dml_op.get_eval_ctx(), ins_rtdef.cur_row_num_, ins_ctdef.column_infos_, - ins_ctdef.das_ctdef_, + ins_ctdef.das_ctdef_.is_ignore_, ins_ctdef.is_single_value_, dml_op))) { LOG_WARN("check row null failed", K(ret)); @@ -814,7 +811,7 @@ int ObDMLService::process_update_row(const ObUpdCtDef &upd_ctdef, dml_op.get_eval_ctx(), upd_rtdef.cur_row_num_, upd_ctdef.assign_columns_, - upd_ctdef.dupd_ctdef_, + upd_ctdef.dupd_ctdef_.is_ignore_, false, dml_op))) { LOG_WARN("check row null failed", K(ret), K(upd_ctdef), K(upd_rtdef)); @@ -1027,11 +1024,7 @@ int ObDMLService::update_row(const ObUpdCtDef &upd_ctdef, } } else if (OB_UNLIKELY(old_tablet_loc != new_tablet_loc)) { //the updated row may be moved across partitions - if (upd_ctdef.dupd_ctdef_.is_ignore_) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, "Cross-partition update ignore"); - LOG_WARN("update ignore is not supported in across partition update, it will induce lost data error", K(ret)); - } else if (OB_LIKELY(!upd_ctdef.multi_ctdef_->is_enable_row_movement_)) { + if (OB_LIKELY(!upd_ctdef.multi_ctdef_->is_enable_row_movement_)) { ret = OB_ERR_UPD_CAUSE_PART_CHANGE; LOG_WARN("the updated row is moved across partitions", K(ret), KPC(old_tablet_loc), KPC(new_tablet_loc)); diff --git a/src/sql/engine/dml/ob_dml_service.h b/src/sql/engine/dml/ob_dml_service.h index aba7407d1e..7afb5f5870 100644 --- a/src/sql/engine/dml/ob_dml_service.h +++ b/src/sql/engine/dml/ob_dml_service.h @@ -28,7 +28,7 @@ public: ObEvalCtx &eval_ctx, int64_t row_num, const ColContentIArray &column_infos, - const ObDASDMLBaseCtDef &das_ctdef, + bool is_ignore, bool is_single_value, ObTableModifyOp &dml_op); static int check_column_type(const ExprFixedArray &dml_row, diff --git a/src/sql/engine/pdml/static/ob_px_multi_part_insert_op.cpp b/src/sql/engine/pdml/static/ob_px_multi_part_insert_op.cpp index ea7137b187..ecbd2f8762 100644 --- a/src/sql/engine/pdml/static/ob_px_multi_part_insert_op.cpp +++ b/src/sql/engine/pdml/static/ob_px_multi_part_insert_op.cpp @@ -132,7 +132,7 @@ int ObPxMultiPartInsertOp::process_row() eval_ctx_, ins_rtdef_.cur_row_num_, MY_SPEC.ins_ctdef_.column_infos_, - MY_SPEC.ins_ctdef_.das_ctdef_, + MY_SPEC.is_ignore_, MY_SPEC.ins_ctdef_.is_single_value_, *this)); OZ(ObDMLService::filter_row_for_view_check(MY_SPEC.ins_ctdef_.view_check_exprs_, eval_ctx_, is_filtered));