提交 2146f1d1 编写于 作者: O obdev 提交者: linzhigang.lzg

[CP] fix bit type extract query range bug

上级 560dbb58
......@@ -4764,6 +4764,17 @@ int ObOptimizerUtil::is_lossless_column_cast(const ObRawExpr* expr, bool& is_los
is_lossless = true;
}
}
} else if (ObBitTC == column_tc) {
if (ObNumberTC == dst_tc) {
const double log10_2 = 0.30103;
ObAccuracy lossless_acc = column_type.get_accuracy();
if (dst_acc.get_scale() >= 0 &&
dst_acc.get_precision() - dst_acc.get_scale() >= lossless_acc.get_precision() * log10_2) {
// log10(2) = 0.30102999566398114; log10(2^n) = n*log10(2);
// cast(b'111' as decimal(1,0)) is lossless
is_lossless = true;
}
}
} else if (ObFloatTC == column_tc || ObDoubleTC == column_tc) {
if (ObDoubleTC == dst_tc) {
if (-1 == dst_acc.get_precision() && -1 == dst_acc.get_scale()) {
......
......@@ -1349,7 +1349,7 @@ BEGIN(in_c_comment);
// for 'select - -1 from dual'
// the first neg sign is not copied when it is parsed
// but when the second neg sign is parsed, the first neg sign must be put where is should be
if ('-' == yytext[0]) {
if ('-' == yytext[0] && IS_NEED_PARAMETERIZE) {
REPUT_NEG_SIGN(p);
p->minus_ctx_.pos_ = p->no_param_sql_len_;
p->minus_ctx_.raw_sql_offset_ = yylloc->first_column - 1;
......
......@@ -5329,8 +5329,8 @@ int ObDMLResolver::parse_qb_in_rewrite_hint(const ParseNode* hint_node, common::
ret = OB_ERR_UNEXPECTED;
LOG_WARN("qb table name has no one children.", K(ret));
} else if (OB_ISNULL(qb_table_name->children_[0])) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("qb table name has null children.", K(ret));
// allowed use hint like USE_CONCAT()
type = hint_type;
} else if (OB_FAIL(resolve_qb_name_node(qb_table_name->children_[0], qb_name))) {
LOG_WARN("failed to resolve the rewrite hint.", K(ret));
} else if (OB_FAIL(qb_names.push_back(qb_name))) {
......
......@@ -1209,6 +1209,9 @@ int ObStmtHint::print_rewrite_hints_for_outline(planText& plan_text, const char*
for (int64_t idx = 0; OB_SUCC(ret) && idx < qb_names.count(); ++idx) {
ObString qb_name = qb_names.at(idx);
if (OUTLINE_DATA == outline_type && OB_FAIL(query_ctx->get_stmt_org_name(qb_name, origin_name))) {
// for invalid qb name, reset ret
// select /*+use_concat(@sel$5)*/ * from t1;
ret = OB_SUCCESS;
} else if (USED_HINT == outline_type && FALSE_IT(origin_name = qb_name)) {
} else if (!is_oneline && OB_FAIL(BUF_PRINTF("\n"))) {
} else if (OB_FAIL(BUF_PRINTF(get_outline_indent(is_oneline)))) {
......
......@@ -694,9 +694,6 @@ int ObTransformJoinElimination::eliminate_outer_join(ObDMLStmt* stmt, bool& tran
LOG_WARN("semi info is null", K(ret));
} else if (OB_FAIL(ObOptimizerUtil::remove_item(semi_infos.at(i)->left_table_ids_, table_ids))) {
LOG_WARN("failed to eliminate outer join in from items.", K(ret));
} else if (OB_UNLIKELY(semi_infos.at(i)->left_table_ids_.empty())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("left_table_ids_ is empty", K(ret));
}
}
if (OB_FAIL(ret)) {
......
......@@ -452,7 +452,7 @@ int ObTransformOuterJoinLimitPushDown::do_transform(OjLimitPushDownHelper& helpe
helper.view_table_,
helper.extracted_conditions_,
helper.saved_order_items_,
!helper.need_create_view_,
helper.need_rename_,
helper.is_limit_only_))) {
LOG_WARN("failed to push down view table", K(ret));
} else { /* do nothing */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册