More fixes due to "in" function arguments being incorrectly checked as ASTIdentifier

This commit is contained in:
Ivan Lezhankin 2021-06-01 14:20:03 +03:00
parent d0ad6d9cff
commit 365e52817b
2 changed files with 3 additions and 4 deletions

View File

@ -848,7 +848,7 @@ bool KeyCondition::tryPrepareSetIndex(
const ASTPtr & right_arg = args[1];
SetPtr prepared_set;
if (right_arg->as<ASTSubquery>() || right_arg->as<ASTIdentifier>())
if (right_arg->as<ASTSubquery>() || right_arg->as<ASTTableIdentifier>())
{
auto set_it = prepared_sets.find(PreparedSetKey::forSubquery(*right_arg));
if (set_it == prepared_sets.end())

View File

@ -138,10 +138,9 @@ bool isCompatible(const IAST & node)
if (name == "tuple" && function->arguments->children.size() <= 1)
return false;
/// If the right hand side of IN is an identifier (example: x IN table), then it's not compatible.
/// If the right hand side of IN is a table identifier (example: x IN table), then it's not compatible.
if ((name == "in" || name == "notIn")
&& (function->arguments->children.size() != 2
|| function->arguments->children[1]->as<ASTIdentifier>()))
&& (function->arguments->children.size() != 2 || function->arguments->children[1]->as<ASTTableIdentifier>()))
return false;
for (const auto & expr : function->arguments->children)