ClickHouse/tests/queries/0_stateless/02366_kql_mvexpand.sql
Yong Wang 795c1a98dc
Fix segmentation fault in KQL parser when the input query exceeds the max_query_size (#59626)
* Fix_kql_issue_found_by_wingfuzz

This commit fix the issues:
 https://github.com/ClickHouse/ClickHouse/issues/59036
 https://github.com/ClickHouse/ClickHouse/issues/59037

both issues are same reason, the input query exceed the max_query_size,
so the condition isEnd() of token is not meet and cause the assertion failure

* fix_kql_issue_found_by_wingfuzz: use isValid instead of TokenType::EndOfStream

* fix_kql_issue_found_by_wingfuzz: make functional test result consist

* fix_kql_issue_found_by_wingfuzz: update test case for makeseries

* fix_kql_issue_found_by_wingfuzz: disable makeseries

* fix_kql_issue_found_by_wingfuzz:
 use isvalid() function to replace isEnd() function of TokenIterator to check the end of stream

* fix_kql_issue_found_by_wingfuzz: add test case for max_query_size

* fix_kql_issue_found_by_wingfuzz: fix AST structure

* fix_kql_issue_found_by_wingfuzz: make sure the max query size test is in the dialect of kusto

* fix_kql_issue_found_by_wingfuzz : restore max query size after test

* fix_kql_issue_found_by_wingfuzz : fix typo

---------

Co-authored-by: János Benjamin Antal <benjamin.antal@clickhouse.com>
2024-02-26 13:31:47 +01:00

36 lines
1.7 KiB
SQL

-- datatable(a: int, b: dynamic, c: dynamic, d: dynamic) [
-- 1, dynamic(['Salmon', 'Steak', 'Chicken']), dynamic([1, 2, 3, 4]), dynamic([5, 6, 7, 8])
-- ]
DROP TABLE IF EXISTS mv_expand_test_table;
CREATE TABLE mv_expand_test_table
(
a UInt8,
b Array(String),
c Array(Int8),
d Array(Int8)
) ENGINE = Memory;
INSERT INTO mv_expand_test_table VALUES (1, ['Salmon', 'Steak','Chicken'],[1,2,3,4],[5,6,7,8]);
set dialect='kusto';
print '-- mv-expand --';
print '-- mv_expand_test_table | mv-expand c --';
mv_expand_test_table | mv-expand c;
print '-- mv_expand_test_table | mv-expand c, d --';
mv_expand_test_table | mv-expand c, d;
print '-- mv_expand_test_table | mv-expand b | mv-expand c --';
mv_expand_test_table | mv-expand b | mv-expand c;
print '-- mv_expand_test_table | mv-expand with_itemindex=index b, c, d --';
mv_expand_test_table | mv-expand with_itemindex=index b, c, d;
print '-- mv_expand_test_table | mv-expand array_concat(c,d) --';
mv_expand_test_table | mv-expand array_concat(c,d);
print '-- mv_expand_test_table | mv-expand x = c, y = d --';
mv_expand_test_table | mv-expand x = c, y = d;
print '-- mv_expand_test_table | mv-expand xy = array_concat(c, d) --';
mv_expand_test_table | mv-expand xy = array_concat(c, d);
print '-- mv_expand_test_table | mv-expand xy = array_concat(c, d) limit 2| summarize count() by xy --';
mv_expand_test_table | mv-expand xy = array_concat(c, d) limit 2| summarize count() by xy;
print '-- mv_expand_test_table | mv-expand with_itemindex=index c,d to typeof(bool) --';
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);