mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Kusto-phase2: allow negative operators for kql table function only
This commit is contained in:
parent
4a5f462e43
commit
5621ca5984
@ -44,9 +44,16 @@ UnmatchedParentheses checkUnmatchedParentheses(TokenIterator begin)
|
|||||||
|
|
||||||
/// We have to iterate through all tokens until the end to avoid false positive "Unmatched parentheses" error
|
/// We have to iterate through all tokens until the end to avoid false positive "Unmatched parentheses" error
|
||||||
/// when parser failed in the middle of the query.
|
/// when parser failed in the middle of the query.
|
||||||
|
bool inside_kql = false;
|
||||||
for (TokenIterator it = begin; !it->isEnd(); ++it)
|
for (TokenIterator it = begin; !it->isEnd(); ++it)
|
||||||
{
|
{
|
||||||
if (!it.isValid()) // allow kql negative operators
|
TokenIterator it_prev = it;
|
||||||
|
if (it != begin)
|
||||||
|
--it_prev;
|
||||||
|
if (it != begin && it->type == TokenType::OpeningRoundBracket && String(it_prev.get().begin, it_prev.get().end) == "kql")
|
||||||
|
inside_kql = true;
|
||||||
|
|
||||||
|
if (!it.isValid() && inside_kql) // allow negative operators inside kql table function
|
||||||
{
|
{
|
||||||
if (it->type == TokenType::ErrorSingleExclamationMark)
|
if (it->type == TokenType::ErrorSingleExclamationMark)
|
||||||
{
|
{
|
||||||
@ -64,10 +71,8 @@ UnmatchedParentheses checkUnmatchedParentheses(TokenIterator begin)
|
|||||||
{
|
{
|
||||||
if (String(it.get().begin, it.get().end) == "~")
|
if (String(it.get().begin, it.get().end) == "~")
|
||||||
{
|
{
|
||||||
--it;
|
if (const auto prev = String(it_prev.get().begin, it_prev.get().end); prev != "!" && prev != "=" && prev != "in")
|
||||||
if (const auto prev = String(it.get().begin, it.get().end); prev != "!" && prev != "=" && prev != "in")
|
|
||||||
break;
|
break;
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user