diff --git a/src/sql/engine/expr/ob_expr_json_query.cpp b/src/sql/engine/expr/ob_expr_json_query.cpp index a8faf92274..cbb3b38fa5 100644 --- a/src/sql/engine/expr/ob_expr_json_query.cpp +++ b/src/sql/engine/expr/ob_expr_json_query.cpp @@ -824,6 +824,7 @@ int ObExprJsonQuery::deal_item_method_special_case(ObJsonPath* j_path, INIT_SUCC(ret); if (hits[pos]->json_type() == ObJsonNodeType::J_NULL && !hits[pos]->is_real_json_null(hits[pos])) { is_null_result = true; + } else if (!j_path->is_last_func()) { // do nothing } else if (!use_wrapper && j_path->is_last_func() && j_path->path_node_cnt() == 1) { // do nothing } else if (j_path->get_last_node_type() == JPN_LENGTH && !(hits[pos]->json_type() == ObJsonNodeType::J_UINT && ((ObJsonUint *)hits[pos])->get_is_string_length())) { // distinct uint and length() diff --git a/src/sql/engine/expr/ob_expr_json_utils.cpp b/src/sql/engine/expr/ob_expr_json_utils.cpp index 58e7aaacc5..dc9d3bc19c 100644 --- a/src/sql/engine/expr/ob_expr_json_utils.cpp +++ b/src/sql/engine/expr/ob_expr_json_utils.cpp @@ -3105,8 +3105,14 @@ int ObJsonUtil::get_query_item_method_null_option(ObJsonPath* j_path, { size_t item_method = static_cast(j_path->get_last_node_type()); size_t json_type = static_cast(j_base->json_type()); + int is_null_res = 0; // first item method pos is JPN_ABS - return OB_JSON_QUERY_ITEM_METHOD_NULL_OPTION[item_method - ObJsonPathNodeType::JPN_ABS][json_type]; + if (!j_path->is_last_func()) { + // do nothing + } else { + is_null_res = OB_JSON_QUERY_ITEM_METHOD_NULL_OPTION[item_method - ObJsonPathNodeType::JPN_ABS][json_type]; + } + return is_null_res; } ObJsonUtil::ObItemMethodValid ObJsonUtil::get_item_method_cast_res_func(ObJsonPath* j_path,