mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
Kusto-phase2 Fixed bug of Syntax error when Order By is followed by another statement
This commit is contained in:
parent
0f598491a9
commit
81cbd23b13
@ -32,7 +32,7 @@ bool ParserKQLSort :: parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
return false;
|
||||
|
||||
pos = op_pos.back();
|
||||
while (!pos->isEnd() && pos->type != TokenType::PipeMark)
|
||||
while (!pos->isEnd() && pos->type != TokenType::PipeMark && pos->type != TokenType::Semicolon)
|
||||
{
|
||||
String tmp(new_pos->begin, new_pos->end);
|
||||
if (tmp == "desc" || tmp == "asc")
|
||||
|
@ -47,14 +47,6 @@ std::pair<String, String> ParserKQLSummarize::removeLastWord(String input)
|
||||
{
|
||||
return std::make_pair(first_part, temp[temp.size() - 1]);
|
||||
}
|
||||
if (!temp.empty())
|
||||
{
|
||||
return std::make_pair(first_part, temp[temp.size() - 1]);
|
||||
}
|
||||
if (!temp.empty())
|
||||
{
|
||||
return std::make_pair(first_part, temp[temp.size() - 1]);
|
||||
}
|
||||
|
||||
return std::make_pair("", "");
|
||||
}
|
||||
|
@ -517,6 +517,75 @@ INSTANTIATE_TEST_SUITE_P(ParserKQLQuery, ParserTest,
|
||||
{
|
||||
"Customers | project parse_ipv6('127.0.0.1')",
|
||||
"SELECT toIPv6OrNull('127.0.0.1')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers|where Occupation has_any ('Skilled','abcd')",
|
||||
"SELECT *\nFROM Customers\nWHERE hasTokenCaseInsensitive(Occupation, 'Skilled') OR hasTokenCaseInsensitive(Occupation, 'abcd')"
|
||||
},
|
||||
{
|
||||
"Customers|where Occupation has_all ('Skilled','abcd')",
|
||||
"SELECT *\nFROM Customers\nWHERE hasTokenCaseInsensitive(Occupation, 'Skilled') AND hasTokenCaseInsensitive(Occupation, 'abcd')"
|
||||
},
|
||||
{
|
||||
"Customers|where Occupation has_all (strcat('Skill','ed'),'Manual')",
|
||||
"SELECT *\nFROM Customers\nWHERE hasTokenCaseInsensitive(Occupation, concat('Skill', 'ed')) AND hasTokenCaseInsensitive(Occupation, 'Manual')"
|
||||
},
|
||||
{
|
||||
"Customers | where Occupation == strcat('Pro','fessional') | take 1",
|
||||
"SELECT *\nFROM Customers\nWHERE Occupation = concat('Pro', 'fessional')\nLIMIT 1"
|
||||
},
|
||||
{
|
||||
"Customers | project countof('The cat sat on the mat', 'at')",
|
||||
"SELECT countSubstrings('The cat sat on the mat', 'at')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project countof('The cat sat on the mat', 'at', 'normal')",
|
||||
"SELECT countSubstrings('The cat sat on the mat', 'at')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project countof('The cat sat on the mat', 'at', 'regex')",
|
||||
"SELECT countMatches('The cat sat on the mat', 'at')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project extract('(\\b[A-Z]+\\b).+(\\b\\d+)', 0, 'The price of PINEAPPLE ice cream is 10')",
|
||||
"SELECT extract('The price of PINEAPPLE ice cream is 10', '\\b[A-Z]+\\b.+\\b\\\\d+')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project extract('(\\b[A-Z]+\\b).+(\\b\\d+)', 1, 'The price of PINEAPPLE ice cream is 20')",
|
||||
"SELECT extract('The price of PINEAPPLE ice cream is 20', '\\b[A-Z]+\\b')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project extract('(\\b[A-Z]+\\b).+(\\b\\d+)', 2, 'The price of PINEAPPLE ice cream is 30')",
|
||||
"SELECT extract('The price of PINEAPPLE ice cream is 30', '\\b\\\\d+')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project extract('(\\b[A-Z]+\\b).+(\\b\\d+)', 2, 'The price of PINEAPPLE ice cream is 40', typeof(int))",
|
||||
"SELECT CAST(extract('The price of PINEAPPLE ice cream is 40', '\\b\\\\d+'), 'Int32')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project extract_all('(\\w)(\\w+)(\\w)','The price of PINEAPPLE ice cream is 50')",
|
||||
"SELECT extractAllGroups('The price of PINEAPPLE ice cream is 50', '(\\\\w)(\\\\w+)(\\\\w)')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
" Customers | project split('aa_bb', '_')",
|
||||
"SELECT splitByString('_', 'aa_bb')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project split('aaa_bbb_ccc', '_', 1)",
|
||||
"SELECT arrayPushBack([], splitByString('_', 'aaa_bbb_ccc')[2])\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project strcat_delim('-', '1', '2', 'A')",
|
||||
"SELECT concat('1', '-', '2', '-', 'A')\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project indexof('abcdefg','cde')",
|
||||
"SELECT position('abcdefg', 'cde', 1) - 1\nFROM Customers"
|
||||
},
|
||||
{
|
||||
"Customers | project indexof('abcdefg','cde', 2) ",
|
||||
"SELECT position('abcdefg', 'cde', 3) - 1\nFROM Customers"
|
||||
|
||||
}
|
||||
})));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user