mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
795c1a98dc
* 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>
59 lines
2.8 KiB
SQL
59 lines
2.8 KiB
SQL
-- datatable(Supplier:string, Fruit:string, Price: real, Purchase:datetime)
|
|
-- [
|
|
-- 'Aldi','Apple',4,'2016-09-10',
|
|
-- 'Costco','Apple',2,'2016-09-11',
|
|
-- 'Aldi','Apple',6,'2016-09-10',
|
|
-- 'Costco','Snargaluff',100,'2016-09-12',
|
|
-- 'Aldi','Apple',7,'2016-09-12',
|
|
-- 'Aldi','Snargaluff',400,'2016-09-11',
|
|
-- 'Costco','Snargaluff',104,'2016-09-12',
|
|
-- 'Aldi','Apple',5,'2016-09-12',
|
|
-- 'Aldi','Snargaluff',600,'2016-09-11',
|
|
-- 'Costco','Snargaluff',200,'2016-09-10',
|
|
-- ]
|
|
|
|
DROP TABLE IF EXISTS Ledger;
|
|
CREATE TABLE Ledger
|
|
(
|
|
Supplier Nullable(String),
|
|
Fruit String ,
|
|
Price Float64,
|
|
Purchase Date
|
|
) ENGINE = Memory;
|
|
INSERT INTO Ledger VALUES ('Aldi','Apple',4,'2016-09-10'), ('Costco','Apple',2,'2016-09-11'), ('Aldi','Apple',6,'2016-09-10'), ('Costco','Snargaluff',100,'2016-09-12'), ('Aldi','Apple',7,'2016-09-12'), ('Aldi','Snargaluff',400,'2016-09-11'),('Costco','Snargaluff',104,'2016-09-12'),('Aldi','Apple',5,'2016-09-12'),('Aldi','Snargaluff',600,'2016-09-11'),('Costco','Snargaluff',200,'2016-09-10');
|
|
|
|
set dialect = 'kusto';
|
|
|
|
print '-- extend #1 --';
|
|
Ledger | extend PriceInCents = 100 * Price | take 2;
|
|
|
|
print '-- extend #2 --';
|
|
Ledger | extend PriceInCents = 100 * Price | sort by PriceInCents asc | project Fruit, PriceInCents | take 2;
|
|
|
|
print '-- extend #3 --';
|
|
Ledger | extend PriceInCents = 100 * Price | sort by PriceInCents asc | project Fruit, PriceInCents | summarize AveragePrice = avg(PriceInCents), Purchases = count() by Fruit | extend Sentence = strcat(Fruit, ' cost ', tostring(AveragePrice), ' on average based on ', tostring(Purchases), ' samples.') | project Sentence | sort by Sentence asc;
|
|
|
|
print '-- extend #4 --';
|
|
Ledger | extend a = Price | extend b = a | extend c = a, d = b + 500 | extend Pass = bool(b == a and c == a and d == b + 500) | summarize binary_all_and(Pass);
|
|
|
|
print '-- extend #5 --';
|
|
Ledger | take 2 | extend strcat(Fruit, ' was purchased from ', Supplier, ' for $', tostring(Price), ' on ', tostring(Purchase)) | extend PriceInCents = 100 * Price;
|
|
|
|
print '-- extend #6 --';
|
|
Ledger | extend Price = 100 * Price;
|
|
|
|
print '-- extend #7 --';
|
|
print a = 4 | extend a = 5;
|
|
|
|
print '-- extend #8 --';
|
|
-- print x = 5 | extend array_sort_desc(range(0, x), range(1, x + 1))
|
|
|
|
print '-- extend #9 --';
|
|
print x = 19 | extend = 4 + ; -- { clientError SYNTAX_ERROR }
|
|
|
|
print '-- extend #10 --';
|
|
Ledger | extend PriceInCents = * Price | sort by PriceInCents asc | project Fruit, PriceInCents | summarize AveragePrice = avg(PriceInCents), Purchases = count() by Fruit | extend Sentence = strcat(Fruit, ' cost ', tostring(AveragePrice), ' on average based on ', tostring(Purchases), ' samples.') | project Sentence; -- { clientError SYNTAX_ERROR }
|
|
|
|
print '-- extend #11 --'; -- should ideally return this in the future: 5 [2,1] because of the alias ex
|
|
print x = 5 | extend ex = array_sort_desc(dynamic([1, 2]), dynamic([3, 4]));
|