diff --git a/src/objit/include/objit/common/ob_item_type.h b/src/objit/include/objit/common/ob_item_type.h index bbe882abf2..13af84f5f7 100755 --- a/src/objit/include/objit/common/ob_item_type.h +++ b/src/objit/include/objit/common/ob_item_type.h @@ -2240,6 +2240,9 @@ typedef enum ObItemType T_ADMIN_STORAGE,// used to support oss storage for clog/sstable T_DYNAMIC_SAMPLING, T_TABLE_DYNAMIC_SAMPLING, + T_PARTITION_HASH_ELEMENT, + T_PARTITION_LIST_ELEMENT, + T_PARTITION_RANGE_ELEMENT, T_MAX //Attention: add a new type before T_MAX } ObItemType; diff --git a/src/sql/parser/sql_parser_mysql_mode.y b/src/sql/parser/sql_parser_mysql_mode.y index 9f42486046..c857b447a5 100755 --- a/src/sql/parser/sql_parser_mysql_mode.y +++ b/src/sql/parser/sql_parser_mysql_mode.y @@ -6493,7 +6493,7 @@ hash_partition_element: PARTITION relation_factor opt_part_id opt_engine_option opt_subpartition_list { UNUSED($4); - malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_ELEMENT, 5, $2, NULL, $3, NULL, $5); + malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_HASH_ELEMENT, 5, $2, NULL, $3, NULL, $5); } ; @@ -6518,7 +6518,7 @@ range_partition_element: PARTITION relation_factor VALUES LESS THAN range_partition_expr opt_part_id opt_engine_option opt_subpartition_list { UNUSED($8); - malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_ELEMENT, 5, $2, $6, $7, NULL, $9); + malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_RANGE_ELEMENT, 5, $2, $6, $7, NULL, $9); } ; @@ -6544,7 +6544,7 @@ list_partition_element: PARTITION relation_factor VALUES IN list_partition_expr opt_part_id opt_engine_option opt_subpartition_list { UNUSED($7); - malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_ELEMENT, 5, $2, $5, $6, NULL, $8); + malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_LIST_ELEMENT, 5, $2, $5, $6, NULL, $8); } ; @@ -6586,7 +6586,7 @@ hash_subpartition_element: SUBPARTITION relation_factor opt_engine_option { UNUSED($3); - malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_ELEMENT, 5, $2, NULL, NULL, NULL, NULL); + malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_HASH_ELEMENT, 5, $2, NULL, NULL, NULL, NULL); } ; @@ -6620,7 +6620,7 @@ range_subpartition_element: SUBPARTITION relation_factor VALUES LESS THAN range_partition_expr opt_engine_option { UNUSED($7); - malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_ELEMENT, 5, $2, $6, NULL, NULL, NULL); + malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_RANGE_ELEMENT, 5, $2, $6, NULL, NULL, NULL); } ; @@ -6646,7 +6646,7 @@ list_subpartition_element: SUBPARTITION relation_factor VALUES IN list_partition_expr opt_engine_option { UNUSED($6); - malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_ELEMENT, 5, $2, $5, NULL, NULL, NULL); + malloc_non_terminal_node($$, result->malloc_pool_, T_PARTITION_LIST_ELEMENT, 5, $2, $5, NULL, NULL, NULL); } ; diff --git a/src/sql/resolver/ddl/ob_ddl_resolver.cpp b/src/sql/resolver/ddl/ob_ddl_resolver.cpp index 5cc06b8845..ca0110c3c4 100644 --- a/src/sql/resolver/ddl/ob_ddl_resolver.cpp +++ b/src/sql/resolver/ddl/ob_ddl_resolver.cpp @@ -5711,6 +5711,9 @@ int ObDDLResolver::resolve_range_partition_elements(ParseNode *node, || OB_ISNULL(element_node->children_[PARTITION_ELEMENT_NODE])) { ret = OB_ERR_UNEXPECTED; LOG_WARN("partition expr list node is null", K(ret), K(element_node)); + } else if (element_node->type_ != T_PARTITION_RANGE_ELEMENT) { + ret = OB_ERR_PARSER_SYNTAX; + LOG_WARN("not a valid range partition define", K(element_node->type_)); } else if ((OB_ISNULL(element_node->children_[PARTITION_NAME_NODE]) || OB_ISNULL(element_node->children_[PARTITION_NAME_NODE]->children_[NAMENODE])) && !is_oracle_mode()) { @@ -6009,6 +6012,9 @@ int ObDDLResolver::resolve_list_partition_elements(ParseNode *node, || OB_ISNULL(element_node->children_[PARTITION_ELEMENT_NODE])) { ret = OB_ERR_UNEXPECTED; LOG_WARN("partition expr list node is null", K(ret), K(element_node)); + } else if (element_node->type_ != T_PARTITION_LIST_ELEMENT) { + ret = OB_ERR_PARSER_SYNTAX; + LOG_WARN("not a valid list partition define", K(element_node->type_)); } else if ((OB_ISNULL(element_node->children_[PARTITION_NAME_NODE]) || OB_ISNULL(element_node->children_[PARTITION_NAME_NODE]->children_[NAMENODE])) && !is_oracle_mode()) { diff --git a/src/sql/resolver/ddl/ob_ddl_resolver.h b/src/sql/resolver/ddl/ob_ddl_resolver.h index 97a02de63d..a56a6fbd5e 100644 --- a/src/sql/resolver/ddl/ob_ddl_resolver.h +++ b/src/sql/resolver/ddl/ob_ddl_resolver.h @@ -1042,8 +1042,11 @@ int ObDDLResolver::resolve_split_into_partition(STMT *stmt, const ParseNode *nod check_part_name = false; part_node = node->children_[i]; share::schema::ObPartition part; - if (OB_ISNULL(part_node) - || T_PARTITION_ELEMENT != part_node->type_) { + if (OB_ISNULL(part_node) || + (T_PARTITION_ELEMENT != part_node->type_ && + T_PARTITION_HASH_ELEMENT != part_node->type_ && + T_PARTITION_LIST_ELEMENT != part_node->type_ && + T_PARTITION_RANGE_ELEMENT != part_node->type_)) { ret = OB_INVALID_ARGUMENT; SQL_RESV_LOG(WARN,"invalid argument", K(ret), K(part_node), "node type", part_node->type_); } else if (OB_NOT_NULL(part_node->children_[ObDDLResolver::PART_ID_NODE])) {