patch bugfix to master

This commit is contained in:
obdev
2023-11-16 10:10:21 +00:00
committed by ob-robot
parent 6701143371
commit 57ee69aca8
20 changed files with 911 additions and 357 deletions

View File

@ -1064,7 +1064,7 @@ static ObExpr::EvalFunc g_expr_eval_functions[] = {
NULL, //ObExprUpdateXml::eval_mysql_update_xml /* 629 */
NULL, //ObExprXmlSequence::eval_xml_sequence /* 630 */
NULL, //ObExprJsonAppend::eval_json_array_append /* 631 */
NULL, //ObExprJsonObjectStar::eval_ora_json_object_star /* 632 */
ObExprJsonObjectStar::eval_ora_json_object_star /* 632 */
};
static ObExpr::EvalBatchFunc g_expr_eval_batch_functions[] = {

View File

@ -481,5 +481,56 @@ int ObExprJsonObject::eval_option_clause_value(ObExpr *expr,
return ret;
}
ObExprJsonObjectStar::ObExprJsonObjectStar(ObIAllocator &alloc)
: ObFuncExprOperator(alloc, T_FUN_SYS_JSON_OBJECT_WILD_STAR, N_JSON_OBJECT_STAR, OCCUR_AS_PAIR, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION)
{
}
ObExprJsonObjectStar::~ObExprJsonObjectStar()
{
}
int ObExprJsonObjectStar::calc_result_typeN(ObExprResType& type,
ObExprResType* types_stack,
int64_t param_num,
ObExprTypeCtx& type_ctx) const
{
INIT_SUCC(ret);
if (param_num != 1) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("incorrect num of param", K(ret));
} else {
types_stack[0].set_calc_type(types_stack[0].get_type());
types_stack[0].set_calc_collation_type(types_stack[0].get_collation_type());
ObExprResType dst_type;
dst_type.set_type(ObObjType::ObVarcharType);
dst_type.set_collation_type(CS_TYPE_INVALID);
dst_type.set_full_length(4000, 1);
if (OB_FAIL(ObJsonExprHelper::set_dest_type(types_stack[0], type, dst_type, type_ctx))) {
LOG_WARN("set dest type failed", K(ret));
} else {
type.set_calc_collation_type(type.get_collation_type());
}
}
return ret;
}
int ObExprJsonObjectStar::eval_ora_json_object_star(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res)
{
INIT_SUCC(ret);
ret = OB_ERR_UNEXPECTED;
LOG_WARN("can not be use this expr, should transform to real column", K(ret));
return ret;
}
int ObExprJsonObjectStar::cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
ObExpr &rt_expr) const
{
UNUSED(expr_cg_ctx);
UNUSED(raw_expr);
rt_expr.eval_func_ = eval_ora_json_object_star;
return OB_SUCCESS;
}
} // sql
} // oceanbase

View File

@ -68,6 +68,21 @@ private:
DISALLOW_COPY_AND_ASSIGN(ObExprJsonObject);
};
// mock inner expr as json object with star node
class ObExprJsonObjectStar : public ObFuncExprOperator
{
public:
explicit ObExprJsonObjectStar(common::ObIAllocator &alloc);
virtual ~ObExprJsonObjectStar();
virtual int calc_result_typeN(ObExprResType& type, ObExprResType* types, int64_t param_num,
common::ObExprTypeCtx& type_ctx) const override;
static int eval_ora_json_object_star(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res);
virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr, ObExpr &rt_expr) const override;
private:
DISALLOW_COPY_AND_ASSIGN(ObExprJsonObjectStar);
};
} //sql
} //oceanbase
#endif //OCEANBASE_SQL_OB_EXPR_JSON_OBJECT_H_

View File

@ -1842,7 +1842,7 @@ int ObExprJsonValue::get_on_mismatch(const ObExpr &expr,
LOG_WARN("mismatch option add fail", K(ret));
}
} else if (option_type >= OB_JSON_TYPE_MISSING_DATA &&
option_type <= OB_JSON_TYPE_IMPLICIT) {
option_type <= OB_JSON_TYPE_DOT) {
uint8_t old_value = 0;
switch(option_type) {
case OB_JSON_TYPE_MISSING_DATA :{

View File

@ -175,6 +175,7 @@ private:
const static uint8_t OB_JSON_TYPE_EXTRA_DATA = 5;
const static uint8_t OB_JSON_TYPE_TYPE_ERROR = 6;
const static uint8_t OB_JSON_TYPE_IMPLICIT = 7;
const static uint8_t OB_JSON_TYPE_DOT = 8;
const static uint8_t json_doc_id = 0;
const static uint8_t json_path_id = 1;

View File

@ -1309,6 +1309,7 @@ void ObExprOperatorFactory::register_expr_operators()
REG_OP_ORCL(ObExprXmlcast);
REG_OP_ORCL(ObExprUpdateXml);
REG_OP_ORCL(ObExprTempTableSSID);
REG_OP_ORCL(ObExprJsonObjectStar);
}
bool ObExprOperatorFactory::is_expr_op_type_valid(ObExprOperatorType type)