[CP] [ctas]: ctas support parallel hint.
This commit is contained in:
parent
8ad8629476
commit
b25f2bcf3e
@ -109,8 +109,9 @@ int ObCreateTableExecutor::ObInsSQLPrinter::inner_print(char *buf, int64_t buf_l
|
||||
LOG_WARN("null stmt", K(ret));
|
||||
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos1,
|
||||
do_osg_
|
||||
? "insert /*+GATHER_OPTIMIZER_STATISTICS*/ into %c%.*s%c.%c%.*s%c"
|
||||
: "insert /*+NO_GATHER_OPTIMIZER_STATISTICS*/ into %c%.*s%c.%c%.*s%c",
|
||||
? "insert /*+ ENABLE_PARALLEL_DML PARALLEL(%lu) GATHER_OPTIMIZER_STATISTICS*/ into %c%.*s%c.%c%.*s%c"
|
||||
: "insert /*+ ENABLE_PARALLEL_DML PARALLEL(%lu) NO_GATHER_OPTIMIZER_STATISTICS*/ into %c%.*s%c.%c%.*s%c",
|
||||
stmt_->get_parallelism(),
|
||||
sep_char,
|
||||
stmt_->get_database_name().length(),
|
||||
stmt_->get_database_name().ptr(),
|
||||
|
@ -4880,12 +4880,12 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor '(' table_element_list ')'
|
||||
opt_table_option_list opt_partition_option select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
(void)($10);
|
||||
ParseNode *table_elements = NULL;
|
||||
ParseNode *table_options = NULL;
|
||||
merge_nodes(table_elements, result, T_TABLE_ELEMENT_LIST, $7);
|
||||
merge_nodes(table_options, result, T_TABLE_OPTION_LIST, $9);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -4894,19 +4894,19 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
$10, /* partition optition */
|
||||
NULL, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$11); /* select_stmt */
|
||||
$11, /* select_stmt */
|
||||
$1); /* hints */
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor '(' table_element_list ')'
|
||||
opt_table_option_list opt_partition_option AS select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
(void)$11;
|
||||
ParseNode *table_elements = NULL;
|
||||
ParseNode *table_options = NULL;
|
||||
merge_nodes(table_elements, result, T_TABLE_ELEMENT_LIST, $7);
|
||||
merge_nodes(table_options, result, T_TABLE_OPTION_LIST, $9);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -4915,19 +4915,19 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
$10, /* partition optition */
|
||||
NULL, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$12); /* select_stmt */
|
||||
$12, /* select_stmt */
|
||||
$1); /* hints */
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor '(' table_element_list ')'
|
||||
opt_table_option_list opt_partition_option with_column_group opt_as select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
(void)$12;
|
||||
ParseNode *table_elements = NULL;
|
||||
ParseNode *table_options = NULL;
|
||||
merge_nodes(table_elements, result, T_TABLE_ELEMENT_LIST, $7);
|
||||
merge_nodes(table_options, result, T_TABLE_OPTION_LIST, $9);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -4936,15 +4936,15 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
$10, /* partition optition */
|
||||
$11, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$13); /* select_stmt */
|
||||
$13, /* select_stmt */
|
||||
$1); /* hints */
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor table_option_list opt_partition_option select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
ParseNode *table_options = NULL;
|
||||
merge_nodes(table_options, result, T_TABLE_OPTION_LIST, $6);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -4953,16 +4953,16 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
$7, /* partition optition */
|
||||
NULL, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$8); /* select_stmt */
|
||||
$8, /* select_stmt */
|
||||
$1);
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor table_option_list opt_partition_option AS select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
(void)$8;
|
||||
ParseNode *table_options = NULL;
|
||||
merge_nodes(table_options, result, T_TABLE_OPTION_LIST, $6);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -4971,16 +4971,16 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
$7, /* partition optition */
|
||||
NULL, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$9); /* select_stmt */
|
||||
$9, /* select_stmt */
|
||||
$1);
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor table_option_list opt_partition_option with_column_group opt_as select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
(void)$9;
|
||||
ParseNode *table_options = NULL;
|
||||
merge_nodes(table_options, result, T_TABLE_OPTION_LIST, $6);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -4989,13 +4989,14 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
$7, /* partition optition */
|
||||
$8, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$10); /* select_stmt */
|
||||
$10, /* select_stmt */
|
||||
$1);
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor partition_option select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -5004,14 +5005,14 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
$6, /* partition optition */
|
||||
NULL, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$7); /* select_stmt */
|
||||
$7, /* select_stmt */
|
||||
$1);
|
||||
$$->reserved_ = 1; /* mean partition optition is partition_option, not opt_partition_option*/
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor partition_option AS select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
(void)$7;
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -5020,14 +5021,14 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
$6, /* partition optition */
|
||||
NULL, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$8); /* select_stmt */
|
||||
$8, /* select_stmt */
|
||||
$1);
|
||||
$$->reserved_ = 1; /* mean partition optition is partition_option, not opt_partition_option*/
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor partition_option with_column_group opt_as select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
(void)$8;
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -5036,13 +5037,13 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
$6, /* partition optition */
|
||||
$7, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$9); /* select_stmt */
|
||||
$9, /* select_stmt */
|
||||
$1);
|
||||
$$->reserved_ = 1; /* mean partition optition is partition_option, not opt_partition_option*/
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -5051,13 +5052,13 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
NULL, /* partition optition */
|
||||
NULL, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$6); /* select_stmt */
|
||||
$6, /* select_stmt */
|
||||
$1); /* hints */
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor with_column_group select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -5066,13 +5067,13 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
NULL, /* partition optition */
|
||||
$6, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$7); /* select_stmt */
|
||||
$7, /* select_stmt */
|
||||
$1);
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor AS select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -5081,13 +5082,13 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
NULL, /* partition optition */
|
||||
NULL, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$7); /* select_stmt */
|
||||
$7, /* select_stmt */
|
||||
$1); /* hints */
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
| create_with_opt_hint special_table_type TABLE opt_if_not_exists relation_factor with_column_group AS select_stmt
|
||||
{
|
||||
(void)($1);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 9,
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_CREATE_TABLE, 10,
|
||||
$2, /* temporary option */
|
||||
$4, /* if not exists */
|
||||
$5, /* table name */
|
||||
@ -5096,7 +5097,8 @@ opt_table_option_list opt_partition_option with_column_group
|
||||
NULL, /* partition optition */
|
||||
$6, /* column group */
|
||||
NULL, /* oracle兼容模式下存放临时表的 on commit 选项 */
|
||||
$8); /* select_stmt */
|
||||
$8, /* select_stmt */
|
||||
$1);
|
||||
$$->reserved_ = 0;
|
||||
}
|
||||
;
|
||||
|
@ -820,6 +820,13 @@ int ObCreateTableResolver::resolve(const ParseNode &parse_tree)
|
||||
LOG_WARN("failed to deep copy string in part expr");
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && is_create_as_sel) {
|
||||
if (OB_FAIL(resolve_hints(create_table_node->children_[CREATE_TABLE_AS_SEL_NUM_CHILD - 1],
|
||||
*create_table_stmt,
|
||||
create_table_stmt->get_create_table_arg().schema_))) {
|
||||
LOG_WARN("fail to resolve hint", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1851,7 +1858,7 @@ int ObCreateTableResolver::resolve_table_elements_from_select(const ParseNode &p
|
||||
int ret = OB_SUCCESS;
|
||||
ObCreateTableStmt *create_table_stmt = static_cast<ObCreateTableStmt *>(stmt_);
|
||||
const ObTableSchema *base_table_schema = NULL;
|
||||
ParseNode *sub_sel_node = parse_tree.children_[CREATE_TABLE_AS_SEL_NUM_CHILD - 1];
|
||||
ParseNode *sub_sel_node = parse_tree.children_[CREATE_TABLE_AS_SEL_NUM_CHILD - 2];
|
||||
ObSelectStmt *select_stmt = NULL;
|
||||
ObSelectResolver select_resolver(params_);
|
||||
select_resolver.params_.is_from_create_table_ = true;
|
||||
|
@ -97,9 +97,9 @@ private:
|
||||
// }
|
||||
//
|
||||
// create table xxx as already_exist_table, pay attention to whether data are need
|
||||
protected:
|
||||
ObSelectStmt *sub_select_stmt_; //create table ... as select...
|
||||
ObSelectStmt *view_define_;
|
||||
protected:
|
||||
ObSelectStmt *sub_select_stmt_; //create table ... as select...
|
||||
ObSelectStmt *view_define_;
|
||||
};
|
||||
|
||||
inline obrpc::ObCreateTableArg &ObCreateTableStmt::get_create_table_arg()
|
||||
|
@ -50,7 +50,7 @@ struct PartitionInfo
|
||||
|
||||
enum NUMCHILD {
|
||||
CREATE_TABLE_NUM_CHILD = 8,
|
||||
CREATE_TABLE_AS_SEL_NUM_CHILD = 9,
|
||||
CREATE_TABLE_AS_SEL_NUM_CHILD = 10,
|
||||
COLUMN_DEFINITION_NUM_CHILD = 4,
|
||||
COLUMN_DEF_NUM_CHILD = 3,
|
||||
INDEX_NUM_CHILD = 5,
|
||||
|
Loading…
x
Reference in New Issue
Block a user