diff --git a/deps/oblib/src/lib/json_type/ob_json_bin.cpp b/deps/oblib/src/lib/json_type/ob_json_bin.cpp index b66acad5a6cf0e2b70e34ce88841b7e84b5170c7..b14b4bf508b10fc8a6894f3d0b6e53a2a13b7f23 100644 --- a/deps/oblib/src/lib/json_type/ob_json_bin.cpp +++ b/deps/oblib/src/lib/json_type/ob_json_bin.cpp @@ -663,7 +663,7 @@ int ObJsonBin::serialize_json_value(ObJsonNode *json_tree, ObJsonBuffer &result) int64_t ser_len = serialization::encoded_length_vi64(sub_obj->length()); int64_t pos = result.length() + sizeof(uint8_t); ObJBVerType vertype = get_string_vertype(); - if (result_.append(reinterpret_cast(&vertype), sizeof(uint8_t))) { + if (OB_FAIL(result_.append(reinterpret_cast(&vertype), sizeof(uint8_t)))) { LOG_WARN("failed to serialize type for str json obj", K(ret), K(ser_len)); } else if (OB_FAIL(result.reserve(ser_len))) { LOG_WARN("failed to reserver serialize size for str json obj", K(ret), K(ser_len)); @@ -746,7 +746,7 @@ int ObJsonBin::serialize_json_value(ObJsonNode *json_tree, ObJsonBuffer &result) uint64_t obj_size = sub_obj->size(); uint16_t field_type = static_cast(sub_obj->field_type()); ObJBVerType vertype = get_opaque_vertype(); - if (result_.append(reinterpret_cast(&vertype), sizeof(uint8_t))) { + if (OB_FAIL(result_.append(reinterpret_cast(&vertype), sizeof(uint8_t)))) { LOG_WARN("failed to serialize type for str json obj", K(ret), K(vertype)); } else if (OB_FAIL(result.append(reinterpret_cast(&field_type), sizeof(uint16_t)))) { LOG_WARN("failed to append opaque json obj type", K(ret)); @@ -983,7 +983,7 @@ int ObJsonBin::deserialize_json_value(const char *data, int64_t pos = 0; if (OB_FAIL(serialization::decode_i16(data, length, pos, &prec))) { LOG_WARN("fail to deserialize decimal precision.", K(ret), K(length)); - } else if (serialization::decode_i16(data, length, pos, &scale)) { + } else if (OB_FAIL(serialization::decode_i16(data, length, pos, &scale))) { LOG_WARN("fail to deserialize decimal scale.", K(ret), K(length), K(prec)); } else if (OB_FAIL(num.deserialize(data, length, pos))) { LOG_WARN("fail to deserialize number.", K(ret), K(length)); @@ -1606,7 +1606,7 @@ int ObJsonBin::raw_binary(ObString &buf, ObIAllocator *allocator) const if (bytes_ * OB_JSON_BIN_REBUILD_THRESHOLD < append_len || OB_JSON_TYPE_IS_INLINE(type_)) { // free space over 30% or inline type, do rebuild ObJsonBuffer& jbuf = *result; - if (OB_FAIL(rebuild_json_value(curr_.ptr() + pos_, curr_.length() - pos_, type, type, uint_val_, jbuf))) { + if (OB_FAIL(rebuild_json_value(curr_.ptr() + pos_, curr_.length() - pos_, type_, type, uint_val_, jbuf))) { LOG_WARN("failed to rebuild inline value", K(ret)); } } else { @@ -3760,7 +3760,7 @@ int ObJsonBin::rebuild_json_value(const char *data, break; } case ObJsonNodeType::J_BOOLEAN: { - if (!is_src_inlined) { + if (!is_dst_inlined) { if (OB_FAIL(serialize_json_integer(inline_data, result))) { LOG_WARN("failed to rebuild serialize boolean.", K(ret), K(inline_data)); } diff --git a/src/sql/engine/expr/ob_expr_in.cpp b/src/sql/engine/expr/ob_expr_in.cpp index dd190439a37c084d067a3d9e344585ddc2ad69f0..1f59b6b177868ea3351bad7c31518b56346ea4d8 100644 --- a/src/sql/engine/expr/ob_expr_in.cpp +++ b/src/sql/engine/expr/ob_expr_in.cpp @@ -618,7 +618,13 @@ int ObExprInOrNotIn::calc_resultN(ObObj& result, const ObObj* objs, int64_t para if (lib::is_oracle_mode() && is_param_is_ext_type_oracle()) { ret = OB_NOT_SUPPORTED; } else { - const bool hashset_lookup = need_hash(expr_ctx.exec_ctx_); + bool hash_json_type = false; + for (int i = 0; i < param_num && !hash_json_type; ++i) { + if (ob_is_json(objs[i].get_type())) { + hash_json_type = true; + } + } + const bool hashset_lookup = hash_json_type && need_hash(expr_ctx.exec_ctx_); bool fall_back = false; if (hashset_lookup) { if (row_dimension_ == 1) { @@ -1186,7 +1192,7 @@ int ObExprInOrNotIn::cg_expr_without_row(ObIAllocator& allocator, const ObRawExp for (int i = 0; i < rt_expr.inner_func_cnt_; i++) { rt_expr.inner_functions_[i] = (void*)func_ptr; } - if (!is_param_all_const()) { + if (!is_param_all_const() || (ob_is_json(left_type) || ob_is_json(right_type))) { rt_expr.eval_func_ = &ObExprInOrNotIn::eval_in_without_row_fallback; } else { rt_expr.eval_func_ = &ObExprInOrNotIn::eval_in_without_row;