[CP] json_schema outrow lob core & xpath subpath length == 0 core
This commit is contained in:
parent
61ed9fb7ea
commit
a5d1780574
@ -4182,13 +4182,16 @@ int ObJsonSchemaCache::find_and_add_cache(ObIJsonBase*& out_schema, ObString& in
|
||||
LOG_WARN("fail to get json base", K(ret), K(in_type));
|
||||
} else {
|
||||
ObJsonSchemaTree json_schema(allocator_);
|
||||
ObString dst_str;
|
||||
if (OB_FAIL(json_schema.build_schema_tree(in_json))) {
|
||||
LOG_WARN("invalid json schema", K(ret));
|
||||
} else if (OB_ISNULL(out_schema = json_schema.get_schema_map())) {
|
||||
ret = OB_BAD_NULL_ERROR;
|
||||
LOG_WARN("should not be null", K(ret));
|
||||
} else if (OB_FAIL(ob_write_string(*allocator_, in_str, dst_str))) {
|
||||
LOG_WARN("fail to copy string", K(ret));
|
||||
} else {
|
||||
ret = set_schema(out_schema, in_str, arg_idx, arg_idx);
|
||||
ret = set_schema(out_schema, dst_str, arg_idx, arg_idx);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
47
deps/oblib/src/lib/xml/ob_path_parser.cpp
vendored
47
deps/oblib/src/lib/xml/ob_path_parser.cpp
vendored
@ -1299,31 +1299,38 @@ int ObPathParser::parse_subpath(ObString& subpath, ObPathNode*& node, bool is_fi
|
||||
ret = OB_BAD_NULL_ERROR;
|
||||
LOG_WARN("should not be null", K(ret));
|
||||
} else {
|
||||
ObPathParser* subpath_parser =
|
||||
static_cast<ObPathParser*> (allocator_->alloc(sizeof(ObPathParser)));
|
||||
if (OB_ISNULL(subpath_parser)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("allocate row buffer failed at location_node", K(ret), K(index_), K(expression_));
|
||||
} else {
|
||||
subpath_parser = new (subpath_parser) ObPathParser(ctx_, parser_type_, subpath, default_ns_, pass_var_);
|
||||
if (is_filter) {
|
||||
if (subpath_parser->is_function_path()) {
|
||||
if (OB_FAIL(subpath_parser->parse_func_node(patharg_type))) {
|
||||
uint64_t not_null_idx = 0;
|
||||
ObXPathUtil::skip_whitespace(subpath, not_null_idx);
|
||||
if (not_null_idx < subpath.length()) {
|
||||
ObPathParser* subpath_parser =
|
||||
static_cast<ObPathParser*> (allocator_->alloc(sizeof(ObPathParser)));
|
||||
if (OB_ISNULL(subpath_parser)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("allocate row buffer failed at location_node", K(ret), K(index_), K(expression_));
|
||||
} else {
|
||||
subpath_parser = new (subpath_parser) ObPathParser(ctx_, parser_type_, subpath, default_ns_, pass_var_);
|
||||
if (is_filter) {
|
||||
if (subpath_parser->is_function_path()) {
|
||||
if (OB_FAIL(subpath_parser->parse_func_node(patharg_type))) {
|
||||
bad_index_ = subpath_parser->bad_index_;
|
||||
LOG_WARN("fail to parse function.", K(ret), K(index_));
|
||||
} // is function
|
||||
} else if (OB_FAIL(subpath_parser->parse_location_path(patharg_type))) {
|
||||
bad_index_ = subpath_parser->bad_index_;
|
||||
LOG_WARN("fail to parse function.", K(ret), K(index_));
|
||||
} // is function
|
||||
} else if (OB_FAIL(subpath_parser->parse_location_path(patharg_type))) {
|
||||
LOG_WARN("fail to parse", K(ret));
|
||||
}
|
||||
} else if (OB_FAIL(subpath_parser->parse_path(IN_FUNCTION))) {
|
||||
bad_index_ = subpath_parser->bad_index_;
|
||||
LOG_WARN("fail to parse", K(ret));
|
||||
}
|
||||
} else if (OB_FAIL(subpath_parser->parse_path(IN_FUNCTION))) {
|
||||
bad_index_ = subpath_parser->bad_index_;
|
||||
LOG_WARN("fail to parse", K(ret));
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_NOT_NULL(subpath_parser->get_root())) {
|
||||
node = subpath_parser->get_root();
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_NOT_NULL(subpath_parser->get_root())) {
|
||||
node = subpath_parser->get_root();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("subpath should not be null", K(ret));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -142,11 +142,10 @@ int ObJsonExprHelper::get_json_schema(const ObExpr &expr, ObEvalCtx &ctx,
|
||||
} else if (is_null) {
|
||||
} else {
|
||||
ObJsonInType j_in_type = ObJsonExprHelper::get_json_internal_type(type);
|
||||
ObJsonSchemaCache ctx_cache(&allocator);
|
||||
ObJsonSchemaCache* schema_cache = ObJsonExprHelper::get_schema_cache_ctx(expr.expr_ctx_id_, &ctx.exec_ctx_);
|
||||
schema_cache = ((schema_cache != nullptr) ? schema_cache : &ctx_cache);
|
||||
|
||||
if (OB_SUCC(ret) && OB_FAIL(ObJsonExprHelper::find_and_add_schema_cache(schema_cache, j_schema, j_str, 1, j_in_type))) {
|
||||
if (OB_SUCC(ret) && OB_NOT_NULL(schema_cache)
|
||||
&& OB_FAIL(ObJsonExprHelper::find_and_add_schema_cache(schema_cache, j_schema, j_str, 1, j_in_type))) {
|
||||
LOG_WARN("invalid json schema", K(ret));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user