bugfix:47099280, 47725591, 47679463, 47077540, 47024555
This commit is contained in:
@ -1562,9 +1562,6 @@ int ObJsonExprHelper::check_item_func_with_return(ObJsonPathNodeType path_type,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case JPN_CEILING :{
|
||||
break;
|
||||
}
|
||||
case JPN_DATE :{
|
||||
if (dst_type == ObDateTimeType) {
|
||||
} else {
|
||||
@ -1581,14 +1578,13 @@ int ObJsonExprHelper::check_item_func_with_return(ObJsonPathNodeType path_type,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case JPN_FLOOR :{
|
||||
break;
|
||||
}
|
||||
case JPN_FLOOR :
|
||||
case JPN_CEILING :
|
||||
case JPN_LENGTH :
|
||||
case JPN_NUMBER :
|
||||
case JPN_NUM_ONLY :
|
||||
case JPN_SIZE :{
|
||||
if (JSON_EXPR_FLAG == 1 || (JSON_EXPR_FLAG ==0 && dst_type == ObNumberType)) {
|
||||
if (JSON_EXPR_FLAG == 1 || (JSON_EXPR_FLAG == 0 && dst_type == ObNumberType)) {
|
||||
} else {
|
||||
ret = OB_ERR_INVALID_DATA_TYPE_RETURNING;
|
||||
LOG_WARN("item func is lower/upper, but return type is ", K(dst_type), K(ret));
|
||||
|
||||
@ -292,10 +292,11 @@ int ObExprJsonQuery::eval_json_query(const ObExpr &expr, ObEvalCtx &ctx, ObDatum
|
||||
LOG_WARN("error occur in wrapper type");
|
||||
} else if (use_wrapper == 0 && hits[0]->json_type() == ObJsonNodeType::J_NULL && !hits[0]->is_real_json_null(hits[0])) {
|
||||
is_null_result = true;
|
||||
} else if (use_wrapper == 0 && j_path->get_last_node_type() == JPN_BOOLEAN && (hits[0]->is_json_number(hits[0]->json_type()) || hits[0]->json_type() == ObJsonNodeType::J_NULL)) {
|
||||
is_null_result = true;
|
||||
} else if (use_wrapper == 0 && j_path->is_last_func() && j_path->path_node_cnt() == 1) {
|
||||
// do nothing
|
||||
} else if (use_wrapper == 0 && j_path->get_last_node_type() == JPN_BOOLEAN
|
||||
&& (hits[0]->is_json_number(hits[0]->json_type()) || hits[0]->json_type() == ObJsonNodeType::J_NULL)) {
|
||||
is_null_result = true;
|
||||
} else if (use_wrapper == 0 && (j_path->get_last_node_type() == JPN_DATE || j_path->get_last_node_type() == JPN_TIMESTAMP)
|
||||
&& !hits[0]->is_json_date(hits[0]->json_type())) {
|
||||
is_null_result = true;
|
||||
@ -308,6 +309,16 @@ int ObExprJsonQuery::eval_json_query(const ObExpr &expr, ObEvalCtx &ctx, ObDatum
|
||||
} else if (use_wrapper == 0 && (j_path->get_last_node_type() == JPN_UPPER || j_path->get_last_node_type() == JPN_LOWER)
|
||||
&& (hits[0]->json_type() == ObJsonNodeType::J_OBJECT || hits[0]->json_type() == ObJsonNodeType::J_ARRAY)) {
|
||||
is_null_result = true;
|
||||
} else if (use_wrapper == 0 && (j_path->get_last_node_type() == JPN_NUMBER || j_path->get_last_node_type() == JPN_NUM_ONLY
|
||||
|| j_path->get_last_node_type() == JPN_DOUBLE)
|
||||
&& (!hits[0]->is_json_number(hits[0]->json_type()) && hits[0]->json_type() != ObJsonNodeType::J_NULL)) {
|
||||
is_null_result = true;
|
||||
} else if (use_wrapper == 0 && j_path->get_last_node_type() == JPN_LENGTH && !(hits[0]->json_type() == ObJsonNodeType::J_UINT
|
||||
&& ((ObJsonUint *)hits[0])->get_is_string_length())) {
|
||||
is_null_result = true;
|
||||
} else if (use_wrapper == 0 && (j_path->get_last_node_type() == JPN_DATE || j_path->get_last_node_type() == JPN_TIMESTAMP)
|
||||
&& !hits[0]->is_json_date(hits[0]->json_type())) {
|
||||
is_null_result = true;
|
||||
}
|
||||
}
|
||||
} else if (hits.size() == 0) {
|
||||
|
||||
@ -651,7 +651,8 @@ int ObExprJsonValue::doc_do_seek(ObJsonBaseVector &hits, bool &is_null_result, O
|
||||
} else if (j_path->is_last_func()) {
|
||||
if (j_path->get_last_node_type() == ObJsonPathNodeType::JPN_BOOLEAN
|
||||
&& hits[0]->json_type() != ObJsonNodeType::J_BOOLEAN) {
|
||||
if (hits[0]->json_type() == ObJsonNodeType::J_INT
|
||||
if ((hits[0]->json_type() == ObJsonNodeType::J_INT
|
||||
&& (hits[0]->get_int() == 1 || hits[0]->get_int() == 0) )
|
||||
|| (hits[0]->json_type() == ObJsonNodeType::J_DOUBLE
|
||||
&& (hits[0]->get_double() == 1.0 || hits[0]->get_double() == 0.0))) {
|
||||
bool is_true = hits[0]->json_type() == ObJsonNodeType::J_INT ? (hits[0]->get_int() == 1) : (hits[0]->get_double() == 1.0);
|
||||
|
||||
Reference in New Issue
Block a user