提交 533802c2 编写于 作者: W wangt1xiuyi 提交者: ob-robot

fix failed cases and reserve error code in advance on the master branch.

上级 eb6065f4
此差异已折叠。
......@@ -2417,6 +2417,7 @@ DEFINE_ORACLE_ERROR(OB_ERR_REPLACE_TYPE_WITH_TABLE_DEPENDENT, -11006, -1, "HY000
DEFINE_ERROR_EXT(OB_ERR_UNKNOWN_AUTHID, -11007, ER_UNKNOWN_AUTHID, "HY000", "Unknown authorization ID", "Unknown authorization ID `%.*s`@`%.*s`");
DEFINE_ERROR_EXT(OB_ERR_NO_GRANT_DEFINED_FOR_USER, -11008, ER_NONEXISTING_GRANT, "42000", "There is no such grant defined for user", "There is no such grant defined for user '%.*s' on host '%.*s'");
DEFINE_ERROR_EXT(OB_ERR_USER_ALREADY_EXISTS, -11009, ER_USER_ALREADY_EXISTS, "HY000", "Authorization ID already exists", "Authorization ID '%.*s'@'%.*s' already exists");
DEFINE_ORACLE_ERROR(OB_ERR_ARGUMENT_SHOULD_CONSTANT_OR_GROUP_EXPR, -11010, -1, "HY000", "Argument should be a constant or a function of expressions in GROUP BY.", 30497, "Argument should be a constant or a function of expressions in GROUP BY.");
////////////////////////////////////////////////////////////////
// tenant snapshot and tenant clone error codes [-12000 ~ -12100)
......
......@@ -1830,6 +1830,7 @@ constexpr int OB_ERR_REPLACE_TYPE_WITH_TABLE_DEPENDENT = -11006;
constexpr int OB_ERR_UNKNOWN_AUTHID = -11007;
constexpr int OB_ERR_NO_GRANT_DEFINED_FOR_USER = -11008;
constexpr int OB_ERR_USER_ALREADY_EXISTS = -11009;
constexpr int OB_ERR_ARGUMENT_SHOULD_CONSTANT_OR_GROUP_EXPR = -11010;
constexpr int OB_SP_RAISE_APPLICATION_ERROR = -20000;
constexpr int OB_SP_RAISE_APPLICATION_ERROR_NUM = -21000;
constexpr int OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN = -22998;
......@@ -4025,6 +4026,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_UNKNOWN_AUTHID__USER_ERROR_MSG "Unknown authorization ID `%.*s`@`%.*s`"
#define OB_ERR_NO_GRANT_DEFINED_FOR_USER__USER_ERROR_MSG "There is no such grant defined for user '%.*s' on host '%.*s'"
#define OB_ERR_USER_ALREADY_EXISTS__USER_ERROR_MSG "Authorization ID '%.*s'@'%.*s' already exists"
#define OB_ERR_ARGUMENT_SHOULD_CONSTANT_OR_GROUP_EXPR__USER_ERROR_MSG "Argument should be a constant or a function of expressions in GROUP BY."
#define OB_SP_RAISE_APPLICATION_ERROR__USER_ERROR_MSG "%.*s"
#define OB_SP_RAISE_APPLICATION_ERROR_NUM__USER_ERROR_MSG "error number argument to raise_application_error of '%d' is out of range"
#define OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN__USER_ERROR_MSG "CLOB or NCLOB in multibyte character set not supported"
......@@ -6220,6 +6222,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_UNKNOWN_AUTHID__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -11007, Unknown authorization ID `%.*s`@`%.*s`"
#define OB_ERR_NO_GRANT_DEFINED_FOR_USER__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -11008, There is no such grant defined for user '%.*s' on host '%.*s'"
#define OB_ERR_USER_ALREADY_EXISTS__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -11009, Authorization ID '%.*s'@'%.*s' already exists"
#define OB_ERR_ARGUMENT_SHOULD_CONSTANT_OR_GROUP_EXPR__ORA_USER_ERROR_MSG "ORA-30497: Argument should be a constant or a function of expressions in GROUP BY."
#define OB_SP_RAISE_APPLICATION_ERROR__ORA_USER_ERROR_MSG "ORA%06ld: %.*s"
#define OB_SP_RAISE_APPLICATION_ERROR_NUM__ORA_USER_ERROR_MSG "ORA-21000: error number argument to raise_application_error of '%d' is out of range"
#define OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN__ORA_USER_ERROR_MSG "ORA-22998: CLOB or NCLOB in multibyte character set not supported"
......@@ -6230,7 +6233,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_DATA_TOO_LONG_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-12899: value too large for column %.*s (actual: %ld, maximum: %ld)"
#define OB_ERR_INVALID_DATE_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-01861: Incorrect datetime value for column '%.*s' at row %ld"
extern int g_all_ob_errnos[2191];
extern int g_all_ob_errnos[2192];
const char *ob_error_name(const int oberr);
const char* ob_error_cause(const int oberr);
......
......@@ -1561,66 +1561,70 @@ int ObQueryRange::get_rowid_key_part(const ObRawExpr *l_expr,
LOG_WARN("failed to get final expr idx", K(ret));
}
}
for (int64_t i = 0; OB_SUCC(ret) && i < pk_column_items.count(); ++i) {
const ObColumnRefRawExpr *column_item = pk_column_items.at(i);
ObKeyPartId key_part_id(column_item->get_table_id(), column_item->get_column_id());
ObKeyPartPos *key_part_pos = nullptr;
bool b_is_key_part = false;
tmp_key_part = NULL;
if (OB_FAIL(is_key_part(key_part_id, key_part_pos, b_is_key_part))) {
LOG_WARN("is_key_part failed", K(ret));
} else if (!b_is_key_part) {
if (is_physical_rowid &&
query_range_ctx_->phy_rowid_for_table_loc_ &&
table_id != common::OB_INVALID_ID &&
part_column_id != common::OB_INVALID_ID) {
key_part_id.table_id_ = table_id;
key_part_id.column_id_ = part_column_id;
}
if (is_physical_rowid && column_count_ != 1 && !query_range_ctx_->phy_rowid_for_table_loc_) {
GET_ALWAYS_TRUE_OR_FALSE(true, out_key_part);
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < pk_column_items.count(); ++i) {
const ObColumnRefRawExpr *column_item = pk_column_items.at(i);
ObKeyPartId key_part_id(column_item->get_table_id(), column_item->get_column_id());
ObKeyPartPos *key_part_pos = nullptr;
bool b_is_key_part = false;
tmp_key_part = NULL;
if (OB_FAIL(is_key_part(key_part_id, key_part_pos, b_is_key_part))) {
LOG_WARN("is_key_part failed", K(ret));
} else if (!b_is_key_part) {
if (is_physical_rowid &&
query_range_ctx_->phy_rowid_for_table_loc_ &&
table_id != common::OB_INVALID_ID &&
part_column_id != common::OB_INVALID_ID) {
key_part_id.table_id_ = table_id;
key_part_id.column_id_ = part_column_id;
}
if (OB_FAIL(is_key_part(key_part_id, key_part_pos, b_is_key_part))) {
LOG_WARN("is_key_part failed", K(ret));
}
}
}
if (OB_FAIL(ret) || !b_is_key_part) {
GET_ALWAYS_TRUE_OR_FALSE(true, tmp_key_part);
} else if (OB_ISNULL(key_part_pos)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get null key part pos");
} else if (OB_ISNULL((tmp_key_part = create_new_key_part()))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("alloc memory failed", K(ret));
} else {
ObObj tmp_val = val;
tmp_key_part->rowid_column_idx_ = i;
tmp_key_part->is_phy_rowid_key_part_ = is_physical_rowid;
tmp_key_part->id_ = key_part_id;
tmp_key_part->pos_ = *key_part_pos;
tmp_key_part->null_safe_ = false;
//if current expr can be extracted to range, just store the expr
if (c_type != T_OP_LIKE) {
bool is_inconsistent_rowid = false;
if (tmp_val.is_urowid()) {
if (OB_FAIL(get_result_value_with_rowid(*tmp_key_part,
tmp_val,
*query_range_ctx_->exec_ctx_,
is_inconsistent_rowid))) {
LOG_WARN("failed to get result value", K(ret));
} else if (is_inconsistent_rowid) {
GET_ALWAYS_TRUE_OR_FALSE(false, tmp_key_part);
if (OB_FAIL(ret) || !b_is_key_part) {
GET_ALWAYS_TRUE_OR_FALSE(true, tmp_key_part);
} else if (OB_ISNULL(key_part_pos)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get null key part pos");
} else if (OB_ISNULL((tmp_key_part = create_new_key_part()))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("alloc memory failed", K(ret));
} else {
ObObj tmp_val = val;
tmp_key_part->rowid_column_idx_ = i;
tmp_key_part->is_phy_rowid_key_part_ = is_physical_rowid;
tmp_key_part->id_ = key_part_id;
tmp_key_part->pos_ = *key_part_pos;
tmp_key_part->null_safe_ = false;
//if current expr can be extracted to range, just store the expr
if (c_type != T_OP_LIKE) {
bool is_inconsistent_rowid = false;
if (tmp_val.is_urowid()) {
if (OB_FAIL(get_result_value_with_rowid(*tmp_key_part,
tmp_val,
*query_range_ctx_->exec_ctx_,
is_inconsistent_rowid))) {
LOG_WARN("failed to get result value", K(ret));
} else if (is_inconsistent_rowid) {
GET_ALWAYS_TRUE_OR_FALSE(false, tmp_key_part);
}
}
if (OB_FAIL(ret) || is_inconsistent_rowid) {
} else if (OB_FAIL(get_normal_cmp_keypart(c_type, tmp_val, *tmp_key_part))) {
LOG_WARN("get normal cmp keypart failed", K(ret));
}
}
if (OB_FAIL(ret) || is_inconsistent_rowid) {
} else if (OB_FAIL(get_normal_cmp_keypart(c_type, tmp_val, *tmp_key_part))) {
LOG_WARN("get normal cmp keypart failed", K(ret));
}
}
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(add_and_item(key_part_list, tmp_key_part))) {
LOG_WARN("Add basic query key part failed", K(ret));
} else if (pk_column_items.count() - 1 == i &&
OB_FAIL(and_range_graph(key_part_list, out_key_part))) {
LOG_WARN("and basic query key part failed", K(ret));
if (OB_FAIL(ret)) {
} else if (OB_FAIL(add_and_item(key_part_list, tmp_key_part))) {
LOG_WARN("Add basic query key part failed", K(ret));
} else if (pk_column_items.count() - 1 == i &&
OB_FAIL(and_range_graph(key_part_list, out_key_part))) {
LOG_WARN("and basic query key part failed", K(ret));
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册