[scn] fix failure of mittest after refresh feature scn
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
echo -e '#include "objit/common/ob_item_type.h"'
|
||||
echo -e "const char* get_type_name(int type)\n{"
|
||||
echo -e "\tswitch(type){"
|
||||
|
||||
@ -1031,6 +1031,7 @@ static const NonReservedKeyword Mysql_sql_keywords_in_pl[] =
|
||||
{"function", FUNCTION},
|
||||
{"get", GET},
|
||||
{"grant", GRANT},
|
||||
{"hosts", HOSTS},
|
||||
{"index", INDEX},
|
||||
{"insert", INSERT},
|
||||
{"install", INSTALL},
|
||||
|
||||
@ -82,7 +82,7 @@ ObFastParserBase::ObFastParserBase(
|
||||
is_batched_multi_stmt_split_on_(enable_batched_multi_stmt),
|
||||
is_mysql_compatible_comment_(false),
|
||||
cur_token_begin_pos_(0), copy_begin_pos_(0), copy_end_pos_(0),
|
||||
tmp_buf_(nullptr), tmp_buf_len_(0), last_escape_check_pos_(0),
|
||||
tmp_buf_(nullptr), tmp_buf_len_(0), last_well_formed_len_(0),
|
||||
param_node_list_(nullptr), tail_param_node_(nullptr),
|
||||
cur_token_type_(INVALID_TOKEN), allocator_(allocator),
|
||||
parse_next_token_func_(nullptr), process_idf_func_(nullptr)
|
||||
@ -1382,21 +1382,22 @@ inline void ObFastParserBase::check_real_escape(bool &is_real_escape)
|
||||
{
|
||||
if (OB_NOT_NULL(charset_info_) && charset_info_->escape_with_backslash_is_dangerous) {
|
||||
char *cur_pos = tmp_buf_ + tmp_buf_len_;
|
||||
char *last_check_pos = tmp_buf_ + last_escape_check_pos_;
|
||||
char *last_check_pos = tmp_buf_ + last_well_formed_len_;
|
||||
int error = 0;
|
||||
int expected_well_formed_len = cur_pos - last_check_pos;
|
||||
|
||||
while (last_check_pos < cur_pos) {
|
||||
size_t real_well_formed_len = charset_info_->cset->well_formed_len(
|
||||
charset_info_, last_check_pos, cur_pos, UINT64_MAX, &error);
|
||||
last_check_pos += (real_well_formed_len + ((error != 0) ? 1 : 0));
|
||||
}
|
||||
|
||||
if (error != 0) { //the final well-formed result
|
||||
int real_well_formed_len = charset_info_->cset->well_formed_len(
|
||||
charset_info_, last_check_pos, cur_pos, UINT64_MAX, &error);
|
||||
if (error != 0) {
|
||||
*cur_pos = '\\';
|
||||
if (charset_info_->cset->ismbchar(charset_info_, cur_pos - 1, cur_pos + 1)) {
|
||||
if (real_well_formed_len == expected_well_formed_len - 1
|
||||
&& charset_info_->cset->ismbchar(charset_info_, cur_pos - 1, cur_pos + 1)) {
|
||||
is_real_escape = false;
|
||||
last_well_formed_len_ = tmp_buf_len_ + 1;
|
||||
} else {
|
||||
last_well_formed_len_ = tmp_buf_len_;
|
||||
}
|
||||
} else {
|
||||
last_well_formed_len_ = tmp_buf_len_;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1825,7 +1826,7 @@ int ObFastParserMysql::process_string(const char quote)
|
||||
ParseNode **child_node = NULL;
|
||||
char ch = INVALID_CHAR;
|
||||
tmp_buf_len_ = 0;
|
||||
last_escape_check_pos_ = 0;
|
||||
last_well_formed_len_ = 0;
|
||||
if (nullptr == tmp_buf_ &&
|
||||
OB_ISNULL(tmp_buf_ = static_cast<char *>(allocator_.alloc(raw_sql_.raw_sql_len_ + 1)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
@ -1854,7 +1855,6 @@ int ObFastParserMysql::process_string(const char quote)
|
||||
} else {
|
||||
process_escape_string(tmp_buf_, tmp_buf_len_);
|
||||
}
|
||||
last_escape_check_pos_ = tmp_buf_len_;
|
||||
} else if (quote == ch) {
|
||||
if (quote == raw_sql_.peek()) { // double quote
|
||||
ch = raw_sql_.scan();
|
||||
@ -1892,16 +1892,11 @@ int ObFastParserMysql::process_string(const char quote)
|
||||
}
|
||||
} // end while
|
||||
if (OB_SUCC(ret)) {
|
||||
// in ansi_quotes sql_mode, the "" is treated as `, shouldn't parameterize it.
|
||||
bool is_ansi_quotes = false;
|
||||
IS_ANSI_QUOTES(sql_mode_, is_ansi_quotes);
|
||||
raw_sql_.scan();
|
||||
if (!is_quote_end) {
|
||||
cur_token_type_ = IGNORE_TOKEN;
|
||||
ret = OB_ERR_PARSER_SYNTAX;
|
||||
LOG_WARN("parser syntax error", K(ret), K(raw_sql_.to_string()), K_(raw_sql_.cur_pos));
|
||||
} else if (is_ansi_quotes && quote == '"') {
|
||||
cur_token_type_ = NORMAL_TOKEN;
|
||||
} else {
|
||||
char *buf = nullptr;
|
||||
cur_token_type_ = PARAM_TOKEN;
|
||||
|
||||
@ -495,7 +495,7 @@ protected:
|
||||
int64_t copy_end_pos_;
|
||||
char *tmp_buf_;
|
||||
int64_t tmp_buf_len_;
|
||||
int64_t last_escape_check_pos_;
|
||||
int64_t last_well_formed_len_;
|
||||
ParamList *param_node_list_;
|
||||
ParamList *tail_param_node_;
|
||||
TokenType cur_token_type_;
|
||||
|
||||
@ -638,7 +638,7 @@ int ObParser::split_multiple_stmt(const ObString &stmt,
|
||||
ObString part(str_len, stmt.ptr() + offset);
|
||||
ObString remain_part(remain, stmt.ptr() + offset);
|
||||
//first try parse part str, because it's have less length and need less memory
|
||||
if (OB_FAIL(tmp_ret = parse(part, parse_result, parse_mode, false, true))) {
|
||||
if (OB_FAIL(tmp_ret = parse(part, parse_result, parse_mode, false, false, true))) {
|
||||
//if parser part str failed, then try parse all remain part, avoid parse many times
|
||||
//bug: https://work.aone.alibaba-inc.com/issue/34642901
|
||||
tmp_ret = OB_SUCCESS;
|
||||
@ -720,7 +720,7 @@ int ObParser::reconstruct_insert_sql(const common::ObString &stmt,
|
||||
allocator.set_label("InsMultiValOpt");
|
||||
ObIAllocator *bak_allocator = allocator_;
|
||||
allocator_ = &allocator;
|
||||
if (OB_FAIL(parse(stmt, parse_result, parse_mode, false, true))) {
|
||||
if (OB_FAIL(parse(stmt, parse_result, parse_mode, false, false, true))) {
|
||||
// if parser SQL failed,then we won't rewrite it and keep it as it is
|
||||
LOG_WARN("failed to parser insert sql", K(ret));
|
||||
} else if (parse_result.ins_multi_value_res_->values_count_ == 1) {
|
||||
@ -944,6 +944,7 @@ int ObParser::parse(const ObString &query,
|
||||
ParseResult &parse_result,
|
||||
ParseMode parse_mode,
|
||||
const bool is_batched_multi_stmt_split_on,
|
||||
const bool is_normal_ps_prepare,
|
||||
const bool no_throw_parser_error)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -978,15 +979,12 @@ int ObParser::parse(const ObString &query,
|
||||
parse_result.is_for_trigger_ = (TRIGGER_MODE == parse_mode);
|
||||
parse_result.is_dynamic_sql_ = (DYNAMIC_SQL_MODE == parse_mode);
|
||||
parse_result.is_dbms_sql_ = (DBMS_SQL_MODE == parse_mode);
|
||||
parse_result.is_normal_ps_prepare_ = is_normal_ps_prepare;
|
||||
parse_result.is_batched_multi_enabled_split_ = is_batched_multi_stmt_split_on;
|
||||
parse_result.is_not_utf8_connection_ = ObCharset::is_valid_collation(connection_collation_) ?
|
||||
(ObCharset::charset_type_by_coll(connection_collation_) != CHARSET_UTF8MB4) : false;
|
||||
parse_result.malloc_pool_ = allocator_;
|
||||
if (lib::is_oracle_mode()) {
|
||||
parse_result.sql_mode_ = sql_mode_ | SMO_ORACLE;
|
||||
} else {
|
||||
parse_result.sql_mode_ = sql_mode_ & (~SMO_ORACLE);
|
||||
}
|
||||
parse_result.sql_mode_ = sql_mode_;
|
||||
parse_result.need_parameterize_ = (FP_MODE == parse_mode
|
||||
|| FP_PARAMERIZE_AND_FILTER_HINT_MODE == parse_mode);
|
||||
parse_result.minus_ctx_.pos_ = -1;
|
||||
@ -1006,7 +1004,7 @@ int ObParser::parse(const ObString &query,
|
||||
}
|
||||
}
|
||||
|
||||
if (parse_result.is_fp_ || parse_result.is_dynamic_sql_) {
|
||||
if (parse_result.is_fp_ || parse_result.is_dynamic_sql_ || parse_result.is_normal_ps_prepare_) {
|
||||
int64_t new_length = parse_result.is_fp_ ? stmt.length() + 1 : stmt.length() * 2;
|
||||
char *buf = (char *)parse_malloc(new_length, parse_result.malloc_pool_);
|
||||
if (OB_UNLIKELY(NULL == buf)) {
|
||||
|
||||
@ -85,6 +85,7 @@ public:
|
||||
ParseResult &parse_result,
|
||||
ParseMode mode=STD_MODE,
|
||||
const bool is_batched_multi_stmt_split_on = false,
|
||||
const bool is_normal_ps_prepare = false,
|
||||
const bool no_throw_parser_error = false);
|
||||
|
||||
virtual void free_result(ParseResult &parse_result);
|
||||
|
||||
@ -35,5 +35,4 @@ static const int32_t OB_PARSER_ERR_NO_ATTR_FOUND = -9650;
|
||||
static const int32_t OB_PARSER_ERR_NON_INT_LITERAL = -9605;
|
||||
static const int32_t OB_PARSER_ERR_NUMERIC_OR_VALUE_ERROR = -5677;
|
||||
static const int32_t OB_PARSER_ERR_NON_INTEGRAL_NUMERIC_LITERAL = -9670;
|
||||
static const int32_t OB_PARSER_ERR_UNDECLARED_VAR = -5543;
|
||||
#endif /*OCEANBASE_SQL_PARSER_PARSE_DEFINE_*/
|
||||
|
||||
@ -123,13 +123,13 @@ char *parse_str_convert_utf8(const struct ObCharsetInfo* src_cs, const char *str
|
||||
|| OB_ISNULL(out_len)
|
||||
|| OB_ISNULL(extra_errno)) {
|
||||
} else {
|
||||
uint errors = 0;
|
||||
uint errors;
|
||||
size_t str_len = STRLEN(str);
|
||||
size_t dst_len = str_len * 4;
|
||||
if (OB_ISNULL(out_str = static_cast<char *>(parse_malloc(dst_len + 1, malloc_pool)))) {
|
||||
} else {
|
||||
*out_len = static_cast<int64_t>(
|
||||
ob_convert(out_str, dst_len, &ob_charset_utf8mb4_general_ci, str, str_len, src_cs, false, '?', &errors));
|
||||
ob_convert(out_str, dst_len, &ob_charset_utf8mb4_general_ci, str, str_len, src_cs, '?', &errors));
|
||||
out_str[*out_len] = '\0';
|
||||
if (0 != errors) {
|
||||
*extra_errno = OB_PARSER_ERR_ILLEGAL_NAME;
|
||||
@ -267,24 +267,27 @@ char *parse_strdup_with_replace_multi_byte_char(const char *str, int *connection
|
||||
}
|
||||
|
||||
bool check_real_escape(const ObCharsetInfo *cs, char *str, int64_t str_len,
|
||||
int64_t last_escape_check_pos)
|
||||
int64_t *last_well_formed_len)
|
||||
{
|
||||
bool is_real_escape = true;
|
||||
if (NULL != cs && cs->escape_with_backslash_is_dangerous) {
|
||||
if (NULL != cs && NULL != last_well_formed_len && cs->escape_with_backslash_is_dangerous) {
|
||||
char *cur_pos = str + str_len;
|
||||
char *last_check_pos = str + last_escape_check_pos;
|
||||
char *last_check_pos = str + *last_well_formed_len;
|
||||
int error = 0;
|
||||
size_t expected_well_formed_len = cur_pos - last_check_pos;
|
||||
while (last_check_pos < cur_pos) {
|
||||
size_t real_well_formed_len = cs->cset->well_formed_len(
|
||||
cs, last_check_pos, cur_pos, UINT64_MAX, &error);
|
||||
last_check_pos += (real_well_formed_len + ((error != 0) ? 1 : 0));
|
||||
}
|
||||
if (error != 0) { //the final well-formed result
|
||||
size_t real_well_formed_len = cs->cset->well_formed_len(
|
||||
cs, last_check_pos, cur_pos, UINT64_MAX, &error);
|
||||
if (error != 0) {
|
||||
*cur_pos = '\\';
|
||||
if (cs->cset->ismbchar(cs, cur_pos - 1, cur_pos + 1)) {
|
||||
if (real_well_formed_len == expected_well_formed_len - 1
|
||||
&& cs->cset->ismbchar(cs, cur_pos - 1, cur_pos + 1)) {
|
||||
is_real_escape = false;
|
||||
*last_well_formed_len = str_len + 1;
|
||||
} else {
|
||||
*last_well_formed_len = str_len;
|
||||
}
|
||||
} else {
|
||||
*last_well_formed_len = str_len;
|
||||
}
|
||||
}
|
||||
return is_real_escape;
|
||||
|
||||
@ -35,7 +35,7 @@ extern char *cp_str_value(const char *src, const size_t nbyte, void *malloc_pool
|
||||
extern char *parse_strdup_with_replace_multi_byte_char(const char *str, int *connection_collation_,
|
||||
void *malloc_pool, int64_t *out_len);
|
||||
extern bool check_real_escape(const struct ObCharsetInfo *cs, char *str, int64_t str_len,
|
||||
int64_t last_escape_check_pos);
|
||||
int64_t *last_well_formed_len);
|
||||
extern void *parser_alloc(void *malloc_pool, const int64_t alloc_size);
|
||||
|
||||
extern void *malloc_parentheses_info(const size_t nbyte, void *malloc_pool);
|
||||
|
||||
@ -321,7 +321,7 @@ typedef struct
|
||||
PLParseInfo pl_parse_info_;
|
||||
/*for q-quote*/
|
||||
ObMinusStatusCtx minus_ctx_; // for fast parser to parse negative value
|
||||
int64_t last_escape_check_pos_; //解析quoted string%parse-param时的一个临时变量,处理连接gbk字符集时遇到的转义字符问题
|
||||
int64_t last_well_formed_len_; //解析quoted string%parse-param时的一个临时变量,处理连接gbk字符集时遇到的转义字符问题
|
||||
int connection_collation_;//connection collation
|
||||
bool mysql_compatible_comment_; //whether the parser is parsing "/*! xxxx */"
|
||||
bool enable_compatible_comment_;
|
||||
|
||||
@ -310,4 +310,4 @@ int add_alias_name(ParseNode *node, ParseResult *result, int end)
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ extern int64_t ob_strntoll(const char *ptr, size_t len, int base, char **end, in
|
||||
extern int64_t ob_strntoull(const char *ptr, size_t len, int base, char **end, int *err);
|
||||
extern int store_prentthese_info(int left, int right, ParseResult *result);
|
||||
extern bool check_real_escape(const struct ObCharsetInfo *cs, char *str, int64_t str_len,
|
||||
int64_t last_escape_check_pos);
|
||||
int64_t *last_well_formed_len);
|
||||
|
||||
int add_alias_name(ParseNode *node, ParseResult *result, int end);
|
||||
|
||||
@ -111,16 +111,6 @@ int add_alias_name(ParseNode *node, ParseResult *result, int end);
|
||||
return ERROR; \
|
||||
} while(0)
|
||||
|
||||
#define YYABORT_UNDECLARE_VAR \
|
||||
do { \
|
||||
if (OB_UNLIKELY(NULL == result)) { \
|
||||
(void)fprintf(stderr, "ERROR : result is NULL\n"); \
|
||||
} else if (0 == result->extra_errno_) { \
|
||||
result->extra_errno_ = OB_PARSER_ERR_UNDECLARED_VAR;\
|
||||
} else {/*do nothing*/} \
|
||||
YYABORT; \
|
||||
} while(0)
|
||||
|
||||
#define YYABORT_NOT_VALID_ROUTINE_NAME \
|
||||
do { \
|
||||
if (OB_UNLIKELY(NULL == result)) { \
|
||||
@ -342,8 +332,8 @@ do {
|
||||
do { \
|
||||
if (NULL == result) { \
|
||||
YY_UNEXPECTED_ERROR("invalid var node\n"); \
|
||||
} else if ((result->pl_parse_info_.is_pl_parse_ && NULL == result->pl_parse_info_.pl_ns_) \
|
||||
|| result->is_dynamic_sql_) { \
|
||||
} else if ((result->pl_parse_info_.is_pl_parse_ && NULL == result->pl_parse_info_.pl_ns_) || \
|
||||
result->is_dynamic_sql_) { \
|
||||
if (result->no_param_sql_len_ + (start - result->pl_parse_info_.last_pl_symbol_pos_ - 1) \
|
||||
+ (int)(log10(idx)) + 3 \
|
||||
> result->no_param_sql_buf_len_) { \
|
||||
@ -396,7 +386,7 @@ do {
|
||||
} while (0)
|
||||
|
||||
//查找pl变量,并把该变量替换成:int形式
|
||||
#define lookup_pl_exec_symbol(node, result, start, end, is_trigger_new, is_add_alas_name, is_report_error) \
|
||||
#define lookup_pl_exec_symbol(node, result, start, end, is_trigger_new, is_add_alas_name) \
|
||||
do { \
|
||||
if (OB_UNLIKELY((NULL == node || NULL == result || NULL == node->str_value_))) { \
|
||||
yyerror(NULL, result, "invalid var node: %p\n", node); \
|
||||
@ -440,8 +430,6 @@ do {
|
||||
result->no_param_sql_[result->no_param_sql_len_++] = ':'; \
|
||||
result->no_param_sql_len_ += sprintf(result->no_param_sql_ + result->no_param_sql_len_, "%ld", idx); \
|
||||
store_pl_symbol(node, result->param_nodes_, result->tail_param_node_); \
|
||||
} else if (is_report_error) { \
|
||||
YYABORT_UNDECLARE_VAR; \
|
||||
} else { /*do nothing*/ } \
|
||||
} \
|
||||
} while (0)
|
||||
@ -704,7 +692,7 @@ do {
|
||||
|
||||
#define CHECK_REAL_ESCAPE(is_real_escape) \
|
||||
is_real_escape = check_real_escape(p->charset_info_, p->tmp_literal_, \
|
||||
yylval->node->str_len_, p->last_escape_check_pos_)
|
||||
yylval->node->str_len_, &(p->last_well_formed_len_))
|
||||
/*
|
||||
do { \
|
||||
if (NULL != p->charset_info_ && p->charset_info_->escape_with_backslash_is_dangerous) { \
|
||||
|
||||
@ -264,7 +264,7 @@ FALSE {
|
||||
check_value(yylval);
|
||||
malloc_new_node(yylval->node, p->malloc_pool_, T_VARCHAR, 0);
|
||||
yylval->node->str_len_ = 0;
|
||||
p->last_escape_check_pos_ = 0;
|
||||
p->last_well_formed_len_ = 0;
|
||||
yylval->node->str_value_ = NULL;
|
||||
if (IS_FAST_PARAMETERIZE && !IS_NEED_PARAMETERIZE) {
|
||||
COPY_WRITE();
|
||||
@ -327,7 +327,6 @@ FALSE {
|
||||
} else {
|
||||
HANDLE_ESCAPE(p);
|
||||
}
|
||||
p->last_escape_check_pos_ = yylval->node->str_len_;
|
||||
if (IS_FAST_PARAMETERIZE && !IS_NEED_PARAMETERIZE) {
|
||||
COPY_WRITE();
|
||||
}
|
||||
@ -409,7 +408,7 @@ FALSE {
|
||||
}
|
||||
malloc_new_node(yylval->node, p->malloc_pool_, T_VARCHAR, 0);
|
||||
yylval->node->str_len_ = 0;
|
||||
p->last_escape_check_pos_ = 0;
|
||||
p->last_well_formed_len_ = 0;
|
||||
if (IS_FAST_PARAMETERIZE && !IS_NEED_PARAMETERIZE) {
|
||||
return OUTLINE_DEFAULT_TOKEN;
|
||||
}
|
||||
@ -477,7 +476,6 @@ FALSE {
|
||||
} else {
|
||||
HANDLE_ESCAPE(p);
|
||||
}
|
||||
p->last_escape_check_pos_ = yylval->node->str_len_;
|
||||
if (IS_FAST_PARAMETERIZE && !IS_NEED_PARAMETERIZE) {
|
||||
return OUTLINE_DEFAULT_TOKEN;
|
||||
}
|
||||
@ -879,8 +877,6 @@ Timestamp{whitespace}?\"[^\"]*\" {
|
||||
}
|
||||
<hint>INDEX { return INDEX_HINT; }
|
||||
<hint>NO_INDEX { return NO_INDEX_HINT; }
|
||||
<hint>USE_DAS { return USE_DAS_HINT; }
|
||||
<hint>NO_USE_DAS { return NO_USE_DAS_HINT; }
|
||||
<hint>USE_NL { return USE_NL; }
|
||||
<hint>NO_USE_NL { return NO_USE_NL; }
|
||||
<hint>USE_NL_MATERIALIZATION { return USE_NL_MATERIALIZATION; }
|
||||
@ -912,6 +908,7 @@ Timestamp{whitespace}?\"[^\"]*\" {
|
||||
}
|
||||
}
|
||||
}
|
||||
<hint>HOTSPOT { return HOTSPOT; }
|
||||
<hint>LOG_LEVEL { return LOG_LEVEL; }
|
||||
<hint>LEADING { return LEADING_HINT; }
|
||||
<hint>ORDERED { return ORDERED; }
|
||||
@ -941,7 +938,6 @@ Timestamp{whitespace}?\"[^\"]*\" {
|
||||
<hint>END_OUTLINE_DATA { return END_OUTLINE_DATA; }
|
||||
<hint>OPTIMIZER_FEATURES_ENABLE { return OPTIMIZER_FEATURES_ENABLE; }
|
||||
<hint>NO_QUERY_TRANSFORMATION { return NO_QUERY_TRANSFORMATION; }
|
||||
<hint>NO_COST_BASED_QUERY_TRANSFORMATION { return NO_COST_BASED_QUERY_TRANSFORMATION; }
|
||||
<hint>TRANS_PARAM { return TRANS_PARAM; }
|
||||
<hint>PQ_DISTRIBUTE { return PQ_DISTRIBUTE; }
|
||||
<hint>PQ_DISTRIBUTE_WINDOW { return PQ_DISTRIBUTE_WINDOW; }
|
||||
@ -1061,7 +1057,7 @@ Timestamp{whitespace}?\"[^\"]*\" {
|
||||
check_value(yylval);
|
||||
malloc_new_node(yylval->node, p->malloc_pool_, T_VARCHAR, 0);
|
||||
yylval->node->str_len_ = 0;
|
||||
p->last_escape_check_pos_ = 0;
|
||||
p->last_well_formed_len_ = 0;
|
||||
yylval->node->str_value_ = NULL;
|
||||
if (IS_FAST_PARAMETERIZE && !IS_NEED_PARAMETERIZE && !p->is_ignore_token_) {
|
||||
COPY_WRITE();
|
||||
|
||||
@ -149,10 +149,10 @@ extern void obsql_oracle_parse_fatal_error(int32_t errcode, yyscan_t yyscanner,
|
||||
// hint structure
|
||||
BEGIN_OUTLINE_DATA END_OUTLINE_DATA OPTIMIZER_FEATURES_ENABLE QB_NAME
|
||||
// global hint
|
||||
FROZEN_VERSION TOPK QUERY_TIMEOUT READ_CONSISTENCY LOG_LEVEL USE_PLAN_CACHE
|
||||
FROZEN_VERSION TOPK QUERY_TIMEOUT READ_CONSISTENCY HOTSPOT LOG_LEVEL USE_PLAN_CACHE
|
||||
TRACE_LOG LOAD_BATCH_SIZE TRANS_PARAM OPT_PARAM OB_DDL_SCHEMA_VERSION FORCE_REFRESH_LOCATION_CACHE
|
||||
DISABLE_PARALLEL_DML ENABLE_PARALLEL_DML MONITOR NO_PARALLEL CURSOR_SHARING_EXACT
|
||||
MAX_CONCURRENT DOP TRACING NO_QUERY_TRANSFORMATION NO_COST_BASED_QUERY_TRANSFORMATION
|
||||
MAX_CONCURRENT DOP TRACING NO_QUERY_TRANSFORMATION
|
||||
// transform hint
|
||||
NO_REWRITE MERGE_HINT NO_MERGE_HINT NO_EXPAND USE_CONCAT UNNEST NO_UNNEST
|
||||
PLACE_GROUP_BY NO_PLACE_GROUP_BY INLINE MATERIALIZE SEMI_TO_INNER NO_SEMI_TO_INNER
|
||||
@ -166,7 +166,7 @@ COALESCE_SQ NO_COALESCE_SQ COUNT_TO_EXISTS NO_COUNT_TO_EXISTS LEFT_TO_ANTI NO_LE
|
||||
ELIMINATE_JOIN NO_ELIMINATE_JOIN PUSH_LIMIT NO_PUSH_LIMIT PULLUP_EXPR NO_PULLUP_EXPR
|
||||
WIN_MAGIC NO_WIN_MAGIC
|
||||
// optimize hint
|
||||
INDEX_HINT FULL_HINT NO_INDEX_HINT USE_DAS_HINT NO_USE_DAS_HINT LEADING_HINT ORDERED
|
||||
INDEX_HINT FULL_HINT NO_INDEX_HINT LEADING_HINT ORDERED
|
||||
USE_NL USE_MERGE USE_HASH NO_USE_HASH NO_USE_MERGE NO_USE_NL
|
||||
USE_NL_MATERIALIZATION NO_USE_NL_MATERIALIZATION
|
||||
USE_HASH_AGGREGATION NO_USE_HASH_AGGREGATION
|
||||
@ -474,7 +474,7 @@ END_P SET_VAR DELIMITER
|
||||
%type <node> optimize_stmt
|
||||
%type <node> dump_memory_stmt
|
||||
%type <node> create_savepoint_stmt rollback_savepoint_stmt release_savepoint_stmt
|
||||
%type <node> opt_qb_name parallel_hint pq_set_hint_desc
|
||||
%type <node> opt_qb_name parallel_hint
|
||||
%type <node> create_tablespace_stmt drop_tablespace_stmt tablespace rotate_master_key_stmt
|
||||
%type <node> alter_tablespace_stmt
|
||||
%type <node> permanent_tablespace permanent_tablespace_options permanent_tablespace_option alter_tablespace_actions alter_tablespace_action opt_force_purge
|
||||
@ -753,7 +753,7 @@ column_name
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_REF, 3, NULL, NULL, $1);
|
||||
dup_node_string($1, $$, result->malloc_pool_);
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
#endif
|
||||
}
|
||||
| relation_name '.' column_name
|
||||
@ -763,7 +763,7 @@ column_name
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
if (3 == $1->str_len_) {
|
||||
if (0 == strcasecmp("NEW", $1->str_value_) || 0 == strcasecmp("OLD", $1->str_value_)) {
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @3.last_column, true, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @3.last_column, true, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -848,7 +848,7 @@ column_name
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_REF, 3, NULL, NULL, col_name);
|
||||
dup_node_string(col_name, $$, result->malloc_pool_);
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
#endif
|
||||
} else {
|
||||
yyerror(&@1, result, "force key work can be used to be name in PL\n");
|
||||
@ -862,7 +862,7 @@ column_name
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_REF, 3, NULL, NULL, col_name);
|
||||
dup_node_string(col_name, $$, result->malloc_pool_);
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
#endif
|
||||
} else {
|
||||
yyerror(&@1, result, "cascade key work can be used to be name in PL\n");
|
||||
@ -6389,37 +6389,31 @@ REDUNDANT
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_INT);
|
||||
$$->value_ = 1;
|
||||
$$->is_hidden_const_ = 1;
|
||||
}
|
||||
| COMPACT
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_INT);
|
||||
$$->value_ = 2;
|
||||
$$->is_hidden_const_ = 1;
|
||||
}
|
||||
| DYNAMIC
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_INT);
|
||||
$$->value_ = 3;
|
||||
$$->is_hidden_const_ = 1;
|
||||
}
|
||||
| COMPRESSED
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_INT);
|
||||
$$->value_ = 4;
|
||||
$$->is_hidden_const_ = 1;
|
||||
}
|
||||
| CONDENSED
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_INT);
|
||||
$$->value_ = 5;
|
||||
$$->is_hidden_const_ = 1;
|
||||
}
|
||||
| DEFAULT
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_INT);
|
||||
$$->value_ = 3;
|
||||
$$->is_hidden_const_ = 1;
|
||||
}
|
||||
;
|
||||
/*****************************************************************************
|
||||
@ -8081,6 +8075,10 @@ READ_CONSISTENCY '(' consistency_level ')'
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_TOPK, 2, $3, $4);
|
||||
}
|
||||
| HOTSPOT
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_HOTSPOT);
|
||||
}
|
||||
| LOG_LEVEL '(' NAME_OB ')'
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_LOG_LEVEL, 1, $3);
|
||||
@ -8169,10 +8167,6 @@ READ_CONSISTENCY '(' consistency_level ')'
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_NO_QUERY_TRANSFORMATION);
|
||||
}
|
||||
| NO_COST_BASED_QUERY_TRANSFORMATION
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_NO_COST_BASED_QUERY_TRANSFORMATION);
|
||||
}
|
||||
;
|
||||
|
||||
transform_hint:
|
||||
@ -8488,14 +8482,6 @@ INDEX_HINT '(' qb_name_option relation_factor_in_hint NAME_OB ')'
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_FULL_HINT, 2, $3, $4);
|
||||
}
|
||||
| USE_DAS_HINT '(' qb_name_option relation_factor_in_hint ')'
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_USE_DAS_HINT, 2, $3, $4);
|
||||
}
|
||||
| NO_USE_DAS_HINT '(' qb_name_option relation_factor_in_hint ')'
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_NO_USE_DAS_HINT, 2, $3, $4);
|
||||
}
|
||||
| LEADING_HINT '(' qb_name_option relation_factor_in_leading_hint_list ')'
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_LEADING, 2, $3, $4);
|
||||
@ -8590,10 +8576,6 @@ INDEX_HINT '(' qb_name_option relation_factor_in_hint NAME_OB ')'
|
||||
(void)($7); /* unused */
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PQ_DISTRIBUTE, 4, $3, $4, $6, $8);
|
||||
}
|
||||
| PQ_DISTRIBUTE '(' qb_name_option relation_factor_in_pq_hint ')'
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PQ_DISTRIBUTE, 4, $3, $4, NULL, NULL);
|
||||
}
|
||||
| PQ_MAP '(' qb_name_option relation_factor_in_hint ')'
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PQ_MAP, 2, $3, $4);
|
||||
@ -8605,9 +8587,11 @@ INDEX_HINT '(' qb_name_option relation_factor_in_hint NAME_OB ')'
|
||||
merge_nodes(method_list, result, T_DISTRIBUTE_METHOD_LIST, $5);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PQ_DISTRIBUTE_WINDOW, 2, $3, method_list);
|
||||
}
|
||||
| PQ_SET '(' pq_set_hint_desc ')'
|
||||
| PQ_SET '(' qb_name_option distribute_method_list ')'
|
||||
{
|
||||
$$ = $3;
|
||||
ParseNode *method_list = NULL;
|
||||
merge_nodes(method_list, result, T_DISTRIBUTE_METHOD_LIST, $4);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PQ_SET, 2, $3, method_list);
|
||||
}
|
||||
| GBY_PUSHDOWN opt_qb_name
|
||||
{
|
||||
@ -8651,29 +8635,6 @@ INDEX_HINT '(' qb_name_option relation_factor_in_hint NAME_OB ')'
|
||||
}
|
||||
;
|
||||
|
||||
pq_set_hint_desc:
|
||||
'@' qb_name_string qb_name_string distribute_method_list
|
||||
{
|
||||
ParseNode *method_list = NULL;
|
||||
merge_nodes(method_list, result, T_DISTRIBUTE_METHOD_LIST, $4);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PQ_SET, 3, $2, $3, method_list);
|
||||
}
|
||||
| '@' qb_name_string distribute_method_list
|
||||
{
|
||||
ParseNode *method_list = NULL;
|
||||
merge_nodes(method_list, result, T_DISTRIBUTE_METHOD_LIST, $3);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PQ_SET, 3, $2, NULL, method_list);
|
||||
}
|
||||
| '@' qb_name_string qb_name_string
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PQ_SET, 3, $2, $3, NULL);
|
||||
}
|
||||
| '@' qb_name_string
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_PQ_SET, 3, $2, NULL, NULL);
|
||||
}
|
||||
;
|
||||
|
||||
opt_qb_name:
|
||||
'(' qb_name_option ')'
|
||||
{
|
||||
@ -9085,7 +9046,7 @@ expr %prec LOWER_PARENS
|
||||
NULL != $1->children_[2] && T_STAR == $1->children_[2]->type_) {
|
||||
/* do nothing */
|
||||
} else {
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, true, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -10578,7 +10539,7 @@ INTNUM
|
||||
$$ = $1;
|
||||
if (result->pl_parse_info_.is_pl_parse_) {
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -10683,7 +10644,7 @@ column_name
|
||||
$$ = $1;
|
||||
if (result->pl_parse_info_.is_pl_parse_) {
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, true);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -15312,7 +15273,7 @@ column is defined as column := column_name | extension name | extension
|
||||
- AUTO : Oracle determines the columns to collect histograms based on data distribution and the workload of the columns
|
||||
- SKEWONLY : Oracle determines the columns to collect histograms based on the data distribution of the columns
|
||||
- column_name : name of a column
|
||||
- extension : can be either a column group in the format of (column_name, column_name [, ...]) or an expression
|
||||
- extension : can be either a column group in the format of (column_name, colume_name [, ...]) or an expression
|
||||
The default is FOR ALL COLUMNS SIZE AUTO.
|
||||
https://blogs.oracle.com/optimizer/how-does-the-methodopt-parameter-work
|
||||
******************************************************************************/
|
||||
@ -15726,14 +15687,10 @@ new_or_old:
|
||||
new_or_old_column_ref:
|
||||
new_or_old '.' column_name
|
||||
{
|
||||
if (!result->is_for_trigger_) {
|
||||
yyerror(&@2, result, "");
|
||||
YYERROR;
|
||||
}
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_REF, 3, NULL, $1, $3);
|
||||
dup_node_string($3, $$, result->malloc_pool_);
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @3.last_column, true, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @3.last_column, true, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user