bugfix : json table expr format json conflict with json type

This commit is contained in:
obdev
2023-03-02 21:12:02 +08:00
committed by ob-robot
parent 0cb49f4698
commit b2e064e9da
4 changed files with 16 additions and 6 deletions

View File

@ -7796,9 +7796,13 @@ int ObDMLResolver::resolve_json_table_column_type(const ParseNode &parse_tree,
if (col_type == COL_TYPE_ORDINALITY) {
data_type.set_int();
data_type.set_accuracy(ObAccuracy::DDL_DEFAULT_ACCURACY[ObInt32Type]);
} else if (col_type == COL_TYPE_QUERY && obj_type == ObJsonType) {
ret = OB_ERR_INVALID_DATA_TYPE_RETURNING;
LOG_WARN("failed to resolve column, not support return json in query column define", K(ret));
} else if (col_type == COL_TYPE_EXISTS
|| col_type == COL_TYPE_VALUE
|| col_type == COL_TYPE_QUERY) {
|| col_type == COL_TYPE_QUERY
|| col_type == COL_TYPE_QUERY_JSON_COL) {
if (ObNumberType == obj_type
&& parse_tree.int16_values_[2] == -1 && parse_tree.int16_values_[3] == 0) {
obj_type = ObIntType;
@ -7957,7 +7961,7 @@ int ObDMLResolver::resolve_json_table_regular_column(const ParseNode &parse_tree
LOG_WARN("internal error find jt column failed", K(ret));
} else if ((col_type == COL_TYPE_EXISTS && parse_tree.num_child_ != 4) ||
(col_type == COL_TYPE_VALUE && parse_tree.num_child_ != 5) ||
(col_type == COL_TYPE_QUERY && parse_tree.num_child_ != 6) ||
((col_type == COL_TYPE_QUERY || col_type == COL_TYPE_QUERY_JSON_COL) && parse_tree.num_child_ != 6) ||
(col_type == COL_TYPE_ORDINALITY && parse_tree.num_child_ != 2)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to resolve json table regular column", K(ret), K(parse_tree.num_child_), K(col_type));
@ -8012,7 +8016,7 @@ int ObDMLResolver::resolve_json_table_regular_column(const ParseNode &parse_tree
}
}
}
} else if (col_type == COL_TYPE_QUERY) {
} else if (col_type == COL_TYPE_QUERY || col_type == COL_TYPE_QUERY_JSON_COL) {
const ParseNode* scalar_node = parse_tree.children_[2];
const ParseNode* wrapper_node = parse_tree.children_[3];
const ParseNode* path_node = parse_tree.children_[4];
@ -8320,7 +8324,8 @@ int ObDMLResolver::resolve_json_table_column_item(const ParseNode &parse_tree,
if (col_type == COL_TYPE_VALUE ||
col_type == COL_TYPE_QUERY ||
col_type == COL_TYPE_EXISTS ||
col_type == COL_TYPE_ORDINALITY) {
col_type == COL_TYPE_ORDINALITY ||
col_type == COL_TYPE_QUERY_JSON_COL) {
if (OB_FAIL(resolve_json_table_regular_column(*cur_node, table_item, cur_col_def, cur_node_id, id, cur_column_id))) {
LOG_WARN("resolve column defination in json table failed.", K(ret), K(cur_node->value_));
} else if (OB_ISNULL(cur_col_def)) {