fix identity bug

This commit is contained in:
yongshige
2023-03-23 03:15:21 +00:00
committed by ob-robot
parent ea0ab348f3
commit a118af24ee
4 changed files with 4 additions and 5 deletions

View File

@ -361,7 +361,7 @@ int ObTableLoadObjCaster::cast_obj_check(ObTableLoadCastObjCtx &cast_obj_ctx,
bool is_fast_number = cast_obj_ctx.number_fast_ctx_.is_fast_number_; bool is_fast_number = cast_obj_ctx.number_fast_ctx_.is_fast_number_;
bool not_null_validate = (!column_schema->is_nullable() && lib::is_mysql_mode()) || bool not_null_validate = (!column_schema->is_nullable() && lib::is_mysql_mode()) ||
(column_schema->is_not_null_enable_column() && lib::is_oracle_mode()); (column_schema->is_not_null_enable_column() && lib::is_oracle_mode());
if (obj.is_null() && not_null_validate) { if (obj.is_null() && not_null_validate && !column_schema->is_identity_column()) {
const ObString &column_name = column_schema->get_column_name(); const ObString &column_name = column_schema->get_column_name();
ret = OB_BAD_NULL_ERROR; ret = OB_BAD_NULL_ERROR;
LOG_USER_ERROR(OB_BAD_NULL_ERROR, column_name.length(), column_name.ptr()); LOG_USER_ERROR(OB_BAD_NULL_ERROR, column_name.length(), column_name.ptr());

View File

@ -226,7 +226,7 @@ int ObTableLoadPartitionCalc::get_row(ObTableLoadPartitionCalcContext &ctx, cons
ObObj *rowkey_objs = static_cast<ObObj *>(allocator.alloc(sizeof(ObObj) * rowkey_obj_count)); ObObj *rowkey_objs = static_cast<ObObj *>(allocator.alloc(sizeof(ObObj) * rowkey_obj_count));
ObDataTypeCastParams cast_params(&tz_info_); ObDataTypeCastParams cast_params(&tz_info_);
ObCastCtx cast_ctx(&allocator, &cast_params, CM_NONE, ObCharset::get_system_collation()); ObCastCtx cast_ctx(&allocator, &cast_params, CM_NONE, ObCharset::get_system_collation());
ObTableLoadCastObjCtx cast_obj_ctx(ctx.param_, &time_cvrt_, &cast_ctx, false); ObTableLoadCastObjCtx cast_obj_ctx(ctx.param_, &time_cvrt_, &cast_ctx, true);
if (OB_ISNULL(rowkey_objs)) { if (OB_ISNULL(rowkey_objs)) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("fail to alloc memory", KR(ret)); LOG_WARN("fail to alloc memory", KR(ret));

View File

@ -208,7 +208,7 @@ int ObTableLoadTransBucketWriter::handle_partition_with_autoinc_identity(
ObCastCtx cast_ctx(&autoinc_allocator, &cast_params, CM_NONE, ObCastCtx cast_ctx(&autoinc_allocator, &cast_params, CM_NONE,
ObCharset::get_system_collation()); ObCharset::get_system_collation());
ObTableLoadCastObjCtx cast_obj_ctx(param_, &(coordinator_ctx_->partition_calc_.time_cvrt_), &cast_ctx, ObTableLoadCastObjCtx cast_obj_ctx(param_, &(coordinator_ctx_->partition_calc_.time_cvrt_), &cast_ctx,
false); true);
ObObj out_obj; ObObj out_obj;
for (int64_t j = 0; OB_SUCC(ret) && j < row_count; ++j) { for (int64_t j = 0; OB_SUCC(ret) && j < row_count; ++j) {
ObStorageDatum storage_datum; ObStorageDatum storage_datum;

View File

@ -365,8 +365,7 @@ int ObTableLoadTransStoreWriter::cast_row(ObArenaAllocator &cast_allocator,
const ObColumnSchemaV2 *column_schema = column_schemas_.at(i); const ObColumnSchemaV2 *column_schema = column_schemas_.at(i);
ObCastCtx cast_ctx(&cast_allocator, &cast_params, CM_NONE, column_schema->get_collation_type()); ObCastCtx cast_ctx(&cast_allocator, &cast_params, CM_NONE, column_schema->get_collation_type());
ObTableLoadCastObjCtx cast_obj_ctx(param_, &time_cvrt_, &cast_ctx, true); ObTableLoadCastObjCtx cast_obj_ctx(param_, &time_cvrt_, &cast_ctx, true);
if ((!row.cells_[i].is_null() || if ((!row.cells_[i].is_null()) &&
(!column_schema->is_autoincrement() && !column_schema->is_identity_column())) &&
OB_FAIL( OB_FAIL(
ObTableLoadObjCaster::cast_obj(cast_obj_ctx, column_schema, row.cells_[i], out_obj))) { ObTableLoadObjCaster::cast_obj(cast_obj_ctx, column_schema, row.cells_[i], out_obj))) {
LOG_WARN("fail to cast obj and check", KR(ret), K(i), K(row.cells_[i])); LOG_WARN("fail to cast obj and check", KR(ret), K(i), K(row.cells_[i]));