提交 5f1273c9 编写于 作者: 悟世者's avatar 悟世者 提交者: mergify[bot]

fix(tianmu): fix query failure due to incorrect optimization of or statement(#301, #733)

    The reason for the error lies in that in Item_cond_or condition,
    sub-conditions similar to a=a will be cleared after
    elimination of equivalent conditions,
    but the tianmu engine does not do additional scene
    processing for the remaining conditions after elimination
    of equivalent conditions of Item_cond_or.
    Results in a scenario where
    only the remaining predicates are processed
    and the or predicates are not considered.

    The corresponding issuse:
    https://github.com/stoneatom/stonedb/issues/301
    https://github.com/stoneatom/stonedb/issues/733

    revert code style
上级 1a743f8e
......@@ -10150,6 +10150,9 @@ static bool internal_remove_eq_conds(THD *thd, Item *cond,
*cond_value=Item::COND_UNDEF;
Item *item;
bool is_cond_or =
(cond && dynamic_cast<Item_cond_or*>(cond)) ? true : false;
while ((item=li++))
{
Item *new_item;
......@@ -10158,7 +10161,18 @@ static bool internal_remove_eq_conds(THD *thd, Item *cond,
return true;
if (new_item == NULL)
li.remove();
{
if (is_cond_or)
{
Item* cond_true =
new (thd->mem_root) Item_int((longlong)1, 1); // Always true
(void)li.replace(cond_true);
}
else
{
li.remove();
}
}
else if (item != new_item)
{
(void) li.replace(new_item);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册