bugfix: decode adaptation for xml && allow filter for count arg in xpath && filter result cache
This commit is contained in:
parent
e32862ac75
commit
d3dcf6934d
@ -7739,10 +7739,23 @@ int cast_udt_to_other_not_support(const sql::ObExpr &expr, sql::ObEvalCtx &ctx,
|
||||
const ObObjMeta &in_obj_meta = expr.args_[0]->obj_meta_;
|
||||
const ObObjMeta &out_obj_meta = expr.obj_meta_;
|
||||
if (in_obj_meta.is_xml_sql_type()) {
|
||||
// only allow cast basic types to invalid CAST to a type that is not a nested table or VARRAY
|
||||
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
||||
LOG_WARN_RET(ret, "inconsistent datatypes", K(in_obj_meta), K(out_obj_meta),
|
||||
K(out_obj_meta.get_subschema_id()), K(expr.extra_));
|
||||
if (out_obj_meta.is_xml_sql_type()) {
|
||||
ObDatum *child_res = NULL;
|
||||
if (OB_FAIL(expr.args_[0]->eval(ctx, child_res))) {
|
||||
LOG_WARN("eval arg failed", K(ret), K(ctx));
|
||||
} else if (child_res->is_null() ||
|
||||
(lib::is_oracle_mode() && 0 == child_res->len_
|
||||
&& ObLongTextType != expr.args_[0]->datum_meta_.type_)) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
res_datum.set_datum(*child_res);
|
||||
}
|
||||
} else {
|
||||
// only allow cast basic types to invalid CAST to a type that is not a nested table or VARRAY
|
||||
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
||||
LOG_WARN_RET(ret, "inconsistent datatypes", K(in_obj_meta), K(out_obj_meta),
|
||||
K(out_obj_meta.get_subschema_id()), K(expr.extra_));
|
||||
}
|
||||
} else {
|
||||
// other udts
|
||||
// ORA-00932: inconsistent datatypes: expected PLSQL INDEX TABLE got NUMBER
|
||||
|
@ -654,6 +654,8 @@ int ObExprCast::adjust_udt_cast_type(const ObExprResType &src_type, ObExprResTyp
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("cast unsupported sql udt type to pl udt type", K(ret), K(src_type), K(dst_type));
|
||||
}
|
||||
} else if (dst_type.is_user_defined_sql_type()) {
|
||||
dst_type.set_subschema_id(ObXMLSqlType);
|
||||
}
|
||||
} else if (src_type.is_null()) {
|
||||
if (dst_type.get_type() == ObUserDefinedSQLType) {
|
||||
|
@ -62,6 +62,9 @@ int ObExprOracleDecode::calc_result_typeN(ObExprResType &type,
|
||||
LOG_USER_ERROR(OB_ERR_INVALID_TYPE_FOR_OP, "-",
|
||||
ob_obj_type_str(types_stack[0].get_type()));
|
||||
LOG_WARN("invalid type of parameter", K(ret), K(types_stack[0]));
|
||||
} else if (lib::is_oracle_mode() && types_stack[CALC_TYPE_INDEX].get_type() == ObUserDefinedSQLType) {
|
||||
ret = OB_ERR_NO_ORDER_MAP_SQL;
|
||||
LOG_WARN("cannot ORDER objects without MAP or ORDER method", K(ret));
|
||||
}
|
||||
for (int64_t i = 1; OB_SUCC(ret) && i < param_num; i += 2) {
|
||||
if (has_default && i == param_num - 1) {
|
||||
@ -286,6 +289,9 @@ int ObExprOracleDecode::calc_result_typeN(ObExprResType &type,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && lib::is_oracle_mode() &&type.get_type() == ObUserDefinedSQLType) {
|
||||
type.set_subschema_id(ObXMLSqlType);
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (ob_is_otimestamp_type(types_stack[RESULT_TYPE_INDEX].get_type())) {
|
||||
|
@ -103,7 +103,11 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool is_equal_node(ObIMulModeBase* other) {
|
||||
bool is_equal_node(const ObIMulModeBase* other) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_node_before(const ObIMulModeBase* other) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -363,8 +363,6 @@ static ObString bad_func_map[10] = {
|
||||
"count(/abc, /e)",
|
||||
"last()",
|
||||
"/abc/count(/abc)",
|
||||
"count(/abc[1])",
|
||||
"count(position())",
|
||||
};
|
||||
static int func_errcode[10] = {
|
||||
OB_ERR_PARSER_SYNTAX,
|
||||
@ -372,8 +370,6 @@ static int func_errcode[10] = {
|
||||
OB_ERR_PARSER_SYNTAX,
|
||||
OB_OP_NOT_ALLOW,
|
||||
OB_INVALID_ARGUMENT,
|
||||
OB_OP_NOT_ALLOW,
|
||||
OB_ERR_PARSER_SYNTAX,
|
||||
};
|
||||
TEST_F(TestXPath, test_parse_bad_func)
|
||||
{
|
||||
@ -383,7 +379,7 @@ TEST_F(TestXPath, test_parse_bad_func)
|
||||
ObMulModeMemCtx* ctx = nullptr;
|
||||
ASSERT_EQ(ObXmlUtil::create_mulmode_tree_context(&allocator, ctx), OB_SUCCESS);
|
||||
std::cout<<"------begin tag test------"<<std::endl;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
std::cout<<i<<" input: "<<bad_func_map[i].ptr()<<std::endl;
|
||||
ObPathParser test_path(ctx, ObParserType::PARSER_XML_PATH, bad_func_map[i], default_ns, nullptr);
|
||||
ret = test_path.parse_path();
|
||||
|
Loading…
x
Reference in New Issue
Block a user