From fc58ccfa9ee0a37539152d11e401c979f63d4713 Mon Sep 17 00:00:00 2001 From: Yong Wang Date: Wed, 28 Feb 2024 20:15:54 -0800 Subject: [PATCH 1/2] Fix_max_query_size_for_kql_compound_operato: Fix the issue of max_query_size for kql compound operator like mv-expand this fix another use case for PR 59626 --- src/Parsers/Kusto/ParserKQLQuery.cpp | 5 +++-- tests/queries/0_stateless/02366_kql_mvexpand.sql | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Parsers/Kusto/ParserKQLQuery.cpp b/src/Parsers/Kusto/ParserKQLQuery.cpp index 29b26b4e3fed..a54a2b0eda9a 100644 --- a/src/Parsers/Kusto/ParserKQLQuery.cpp +++ b/src/Parsers/Kusto/ParserKQLQuery.cpp @@ -416,8 +416,9 @@ bool ParserKQLQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) ParserToken s_dash(TokenType::Minus); if (s_dash.ignore(pos, expected)) { - String tmp_op(op_pos_begin->begin, pos->end); - kql_operator = tmp_op; + if (!isValidKQLPos(pos)) + return false; + kql_operator = String(op_pos_begin->begin, pos->end); } else --pos; diff --git a/tests/queries/0_stateless/02366_kql_mvexpand.sql b/tests/queries/0_stateless/02366_kql_mvexpand.sql index e77986096463..ac1a6d9a8f4a 100644 --- a/tests/queries/0_stateless/02366_kql_mvexpand.sql +++ b/tests/queries/0_stateless/02366_kql_mvexpand.sql @@ -33,3 +33,7 @@ print '-- mv_expand_test_table | mv-expand with_itemindex=index c,d to typeof(bo mv_expand_test_table | mv-expand with_itemindex=index c,d to typeof(bool); print '-- mv_expand_test_table | mv-expand c to typeof(bool) --'; mv_expand_test_table | mv-expand c to typeof(bool); +SET max_query_size = 28; +SET dialect='kusto'; +mv_expand_test_table | mv-expand c, d; -- { serverError 62 } +SET max_query_size=262144; From 8d106f6c7011e4a938dbc6b6dfa5d5970b8eb5be Mon Sep 17 00:00:00 2001 From: Yong Wang Date: Mon, 4 Mar 2024 06:38:13 -0800 Subject: [PATCH 2/2] Fix_max_query_size_for_kql_compound_operator : update test case for better readability --- tests/queries/0_stateless/02366_kql_mvexpand.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/queries/0_stateless/02366_kql_mvexpand.sql b/tests/queries/0_stateless/02366_kql_mvexpand.sql index ac1a6d9a8f4a..af336a196387 100644 --- a/tests/queries/0_stateless/02366_kql_mvexpand.sql +++ b/tests/queries/0_stateless/02366_kql_mvexpand.sql @@ -35,5 +35,5 @@ print '-- mv_expand_test_table | mv-expand c to typeof(bool) --'; mv_expand_test_table | mv-expand c to typeof(bool); SET max_query_size = 28; SET dialect='kusto'; -mv_expand_test_table | mv-expand c, d; -- { serverError 62 } +mv_expand_test_table | mv-expand c, d; -- { serverError SYNTAX_ERROR } SET max_query_size=262144;