Added a test #5614

This commit is contained in:
Alexey Milovidov 2019-07-07 03:39:45 +03:00
parent a1cfdf2a60
commit 99334d0451
2 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,57 @@
{
"meta":
[
{
"name": "total",
"type": "Nullable(UInt8)"
},
{
"name": "arrayElement(k, 1)",
"type": "Nullable(UInt16)"
},
{
"name": "arrayElement(k, 2)",
"type": "Nullable(UInt16)"
}
],
"data":
[
{
"total": 1,
"arrayElement(k, 1)": null,
"arrayElement(k, 2)": 4
},
{
"total": 1,
"arrayElement(k, 1)": null,
"arrayElement(k, 2)": 2
},
{
"total": 1,
"arrayElement(k, 1)": null,
"arrayElement(k, 2)": 1
},
{
"total": 1,
"arrayElement(k, 1)": null,
"arrayElement(k, 2)": 3
},
{
"total": 1,
"arrayElement(k, 1)": null,
"arrayElement(k, 2)": 5
}
],
"totals":
{
"total": 1,
"arrayElement(k, 1)": null,
"arrayElement(k, 2)": null
},
"rows": 5,
"rows_before_limit_at_least": 5
}

View File

@ -0,0 +1,18 @@
SET output_format_write_statistics = 0;
select
sum(cnt) > 0 as total,
k[1], k[2]
from
(
select
arrayMap( x -> x % 3 ? toNullable(number%5 + x) : null, range(3)) as k,
number % 4 ? toNullable( rand() ) : Null as cnt
from system.numbers_mt
where number < 1000000
limit 1000000
)
group by k with totals
order by total desc
SETTINGS max_threads = 100, max_execution_time = 120
format JSON;