Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
f3087c61
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f3087c61
编写于
10月 19, 2020
作者:
A
alexey-milovidov
提交者:
GitHub
10月 19, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16128 from den-crane/test/nulls-aggregatestates
tests for nullable_aggregate_states
上级
be777660
5cd396b1
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
2453 addition
and
0 deletion
+2453
-0
tests/queries/0_stateless/01518_nullable_aggregate_states1.reference
...es/0_stateless/01518_nullable_aggregate_states1.reference
+5
-0
tests/queries/0_stateless/01518_nullable_aggregate_states1.sql
.../queries/0_stateless/01518_nullable_aggregate_states1.sql
+17
-0
tests/queries/0_stateless/01518_nullable_aggregate_states2.reference
...es/0_stateless/01518_nullable_aggregate_states2.reference
+2020
-0
tests/queries/0_stateless/01518_nullable_aggregate_states2.sql
.../queries/0_stateless/01518_nullable_aggregate_states2.sql
+411
-0
未找到文件。
tests/queries/0_stateless/01518_nullable_aggregate_states1.reference
0 → 100644
浏览文件 @
f3087c61
1 0 \N \N \N \N \N
1 0 \N \N \N \N \N
--- empty resultset ---
0 0 \N \N \N \N \N
0 0 \N \N \N \N \N
tests/queries/0_stateless/01518_nullable_aggregate_states1.sql
0 → 100644
浏览文件 @
f3087c61
select
count
(),
count
(
a
),
max
(
a
),
min
(
a
),
avg
(
a
),
sum
(
a
),
any
(
a
)
from
(
select
cast
(
Null
,
'Nullable(Float64)'
)
a
);
select
countMerge
(
cnts
),
countMerge
(
cntsa
),
maxMerge
(
maxs
),
minMerge
(
mins
),
avgMerge
(
avgs
),
sumMerge
(
sums
),
anyMerge
(
anys
)
from
(
select
countState
()
cnts
,
countState
(
a
)
cntsa
,
maxState
(
a
)
maxs
,
minState
(
a
)
mins
,
avgState
(
a
)
avgs
,
sumState
(
a
)
sums
,
anyState
(
a
)
anys
from
(
select
cast
(
Null
,
'Nullable(Float64)'
)
a
));
select
'--- empty resultset ---'
;
select
count
(),
count
(
a
),
max
(
a
),
min
(
a
),
avg
(
a
),
sum
(
a
),
any
(
a
)
from
(
select
cast
(
1
,
'Nullable(Float64)'
)
a
)
where
a
=
0
;
select
countMerge
(
cnts
),
countMerge
(
cntsa
),
maxMerge
(
maxs
),
minMerge
(
mins
),
avgMerge
(
avgs
),
sumMerge
(
sums
),
anyMerge
(
anys
)
from
(
select
countState
()
cnts
,
countState
(
a
)
cntsa
,
maxState
(
a
)
maxs
,
minState
(
a
)
mins
,
avgState
(
a
)
avgs
,
sumState
(
a
)
sums
,
anyState
(
a
)
anys
from
(
select
cast
(
1
,
'Nullable(Float64)'
)
a
)
where
a
=
0
);
tests/queries/0_stateless/01518_nullable_aggregate_states2.reference
0 → 100644
浏览文件 @
f3087c61
此差异已折叠。
点击以展开。
tests/queries/0_stateless/01518_nullable_aggregate_states2.sql
0 → 100644
浏览文件 @
f3087c61
DROP
TABLE
IF
EXISTS
testNullableStates
;
DROP
TABLE
IF
EXISTS
testNullableStatesAgg
;
CREATE
TABLE
testNullableStates
(
ts
DateTime
,
id
String
,
string
Nullable
(
String
),
float64
Nullable
(
Float64
),
float32
Nullable
(
Float32
),
decimal325
Nullable
(
Decimal32
(
5
)),
date
Nullable
(
Date
),
datetime
Nullable
(
DateTime
),
datetime64
Nullable
(
DateTime64
),
int64
Nullable
(
Int64
),
int32
Nullable
(
Int32
),
int16
Nullable
(
Int16
),
int8
Nullable
(
Int8
))
ENGINE
=
MergeTree
PARTITION
BY
toStartOfDay
(
ts
)
ORDER
BY
id
;
INSERT
INTO
testNullableStates
SELECT
toDateTime
(
'2020-01-01 00:00:00'
)
+
number
AS
ts
,
toString
(
number
%
999
)
AS
id
,
toString
(
number
)
AS
string
,
number
/
333
AS
float64
,
number
/
333
AS
float32
,
number
/
333
AS
decimal325
,
toDate
(
ts
),
ts
,
ts
,
number
,
toInt32
(
number
),
toInt16
(
number
),
toInt8
(
number
)
FROM
numbers
(
100000
);
INSERT
INTO
testNullableStates
SELECT
toDateTime
(
'2020-01-01 00:00:00'
)
+
number
AS
ts
,
toString
(
number
%
999
-
5
)
AS
id
,
NULL
AS
string
,
NULL
AS
float64
,
NULL
AS
float32
,
NULL
AS
decimal325
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
FROM
numbers
(
500
);
CREATE
TABLE
testNullableStatesAgg
(
`ts`
DateTime
,
`id`
String
,
`stringMin`
AggregateFunction
(
min
,
Nullable
(
String
)),
`stringMax`
AggregateFunction
(
max
,
Nullable
(
String
)),
`float64Min`
AggregateFunction
(
min
,
Nullable
(
Float64
)),
`float64Max`
AggregateFunction
(
max
,
Nullable
(
Float64
)),
`float64Avg`
AggregateFunction
(
avg
,
Nullable
(
Float64
)),
`float64Sum`
AggregateFunction
(
sum
,
Nullable
(
Float64
)),
`float32Min`
AggregateFunction
(
min
,
Nullable
(
Float32
)),
`float32Max`
AggregateFunction
(
max
,
Nullable
(
Float32
)),
`float32Avg`
AggregateFunction
(
avg
,
Nullable
(
Float32
)),
`float32Sum`
AggregateFunction
(
sum
,
Nullable
(
Float32
)),
`decimal325Min`
AggregateFunction
(
min
,
Nullable
(
Decimal32
(
5
))),
`decimal325Max`
AggregateFunction
(
max
,
Nullable
(
Decimal32
(
5
))),
`decimal325Avg`
AggregateFunction
(
avg
,
Nullable
(
Decimal32
(
5
))),
`decimal325Sum`
AggregateFunction
(
sum
,
Nullable
(
Decimal32
(
5
))),
`dateMin`
AggregateFunction
(
min
,
Nullable
(
Date
)),
`dateMax`
AggregateFunction
(
max
,
Nullable
(
Date
)),
`datetimeMin`
AggregateFunction
(
min
,
Nullable
(
DateTime
)),
`datetimeMax`
AggregateFunction
(
max
,
Nullable
(
DateTime
)),
`datetime64Min`
AggregateFunction
(
min
,
Nullable
(
datetime64
)),
`datetime64Max`
AggregateFunction
(
max
,
Nullable
(
datetime64
)),
`int64Min`
AggregateFunction
(
min
,
Nullable
(
Int64
)),
`int64Max`
AggregateFunction
(
max
,
Nullable
(
Int64
)),
`int64Avg`
AggregateFunction
(
avg
,
Nullable
(
Int64
)),
`int64Sum`
AggregateFunction
(
sum
,
Nullable
(
Int64
)),
`int32Min`
AggregateFunction
(
min
,
Nullable
(
Int32
)),
`int32Max`
AggregateFunction
(
max
,
Nullable
(
Int32
)),
`int32Avg`
AggregateFunction
(
avg
,
Nullable
(
Int32
)),
`int32Sum`
AggregateFunction
(
sum
,
Nullable
(
Int32
)),
`int16Min`
AggregateFunction
(
min
,
Nullable
(
Int16
)),
`int16Max`
AggregateFunction
(
max
,
Nullable
(
Int16
)),
`int16Avg`
AggregateFunction
(
avg
,
Nullable
(
Int16
)),
`int16Sum`
AggregateFunction
(
sum
,
Nullable
(
Int16
)),
`int8Min`
AggregateFunction
(
min
,
Nullable
(
Int8
)),
`int8Max`
AggregateFunction
(
max
,
Nullable
(
Int8
)),
`int8Avg`
AggregateFunction
(
avg
,
Nullable
(
Int8
)),
`int8Sum`
AggregateFunction
(
sum
,
Nullable
(
Int8
))
)
ENGINE
=
AggregatingMergeTree
()
PARTITION
BY
toStartOfDay
(
ts
)
ORDER
BY
id
;
insert
into
testNullableStatesAgg
select
ts
DateTime
,
id
String
,
minState
(
string
)
stringMin
,
maxState
(
string
)
stringMax
,
minState
(
float64
)
float64Min
,
maxState
(
float64
)
float64Max
,
avgState
(
float64
)
float64Avg
,
sumState
(
float64
)
float64Sum
,
minState
(
float32
)
float32Min
,
maxState
(
float32
)
float32Max
,
avgState
(
float32
)
float32Avg
,
sumState
(
float32
)
float32Sum
,
minState
(
decimal325
)
decimal325Min
,
maxState
(
decimal325
)
decimal325Max
,
avgState
(
decimal325
)
decimal325Avg
,
sumState
(
decimal325
)
decimal325Sum
,
minState
(
date
)
dateMin
,
maxState
(
date
)
dateMax
,
minState
(
datetime
)
datetimeMin
,
maxState
(
datetime
)
datetimeMax
,
minState
(
datetime64
)
datetime64Min
,
maxState
(
datetime64
)
datetime64Max
,
minState
(
int64
)
int64Min
,
maxState
(
int64
)
int64Max
,
avgState
(
int64
)
int64Avg
,
sumState
(
int64
)
int64Sum
,
minState
(
int32
)
int32Min
,
maxState
(
int32
)
int32Max
,
avgState
(
int32
)
int32Avg
,
sumState
(
int32
)
int32Sum
,
minState
(
int16
)
int16Min
,
maxState
(
int16
)
int16Max
,
avgState
(
int16
)
int16Avg
,
sumState
(
int16
)
int16Sum
,
minState
(
int8
)
int8Min
,
maxState
(
int8
)
int8Max
,
avgState
(
int8
)
int8Avg
,
sumState
(
int8
)
int8Sum
from
testNullableStates
group
by
ts
,
id
;
OPTIMIZE
TABLE
testNullableStatesAgg
FINAL
;
select
count
()
from
testNullableStates
;
select
count
()
from
testNullableStatesAgg
;
select
' ---- select without states ---- '
;
SELECT
id
,
count
(),
min
(
string
),
max
(
string
),
floor
(
min
(
float64
),
5
),
floor
(
max
(
float64
),
5
),
floor
(
avg
(
float64
),
5
),
floor
(
sum
(
float64
),
5
),
floor
(
min
(
float32
),
5
),
floor
(
max
(
float32
),
5
),
floor
(
avg
(
float32
),
5
),
floor
(
sum
(
float32
),
5
),
min
(
decimal325
),
max
(
decimal325
),
avg
(
decimal325
),
sum
(
decimal325
),
min
(
date
),
max
(
date
),
min
(
datetime
),
max
(
datetime
),
min
(
datetime64
),
max
(
datetime64
),
min
(
int64
),
max
(
int64
),
avg
(
int64
),
sum
(
int64
),
min
(
int32
),
max
(
int32
),
avg
(
int32
),
sum
(
int32
),
min
(
int16
),
max
(
int16
),
avg
(
int16
),
sum
(
int16
),
min
(
int8
),
max
(
int8
),
avg
(
int8
),
sum
(
int8
)
FROM
testNullableStates
GROUP
BY
id
ORDER
BY
id
ASC
;
select
' ---- select with states ---- '
;
SELECT
id
,
count
(),
minMerge
(
stringMin
),
maxMerge
(
stringMax
),
floor
(
minMerge
(
float64Min
),
5
),
floor
(
maxMerge
(
float64Max
),
5
),
floor
(
avgMerge
(
float64Avg
),
5
),
floor
(
sumMerge
(
float64Sum
),
5
),
floor
(
minMerge
(
float32Min
),
5
),
floor
(
maxMerge
(
float32Max
),
5
),
floor
(
avgMerge
(
float32Avg
),
5
),
floor
(
sumMerge
(
float32Sum
),
5
),
minMerge
(
decimal325Min
),
maxMerge
(
decimal325Max
),
avgMerge
(
decimal325Avg
),
sumMerge
(
decimal325Sum
),
minMerge
(
dateMin
),
maxMerge
(
dateMax
),
minMerge
(
datetimeMin
),
maxMerge
(
datetimeMax
),
minMerge
(
datetime64Min
),
maxMerge
(
datetime64Max
),
minMerge
(
int64Min
),
maxMerge
(
int64Max
),
avgMerge
(
int64Avg
),
sumMerge
(
int64Sum
),
minMerge
(
int32Min
),
maxMerge
(
int32Max
),
avgMerge
(
int32Avg
),
sumMerge
(
int32Sum
),
minMerge
(
int16Min
),
maxMerge
(
int16Max
),
avgMerge
(
int16Avg
),
sumMerge
(
int16Sum
),
minMerge
(
int8Min
),
maxMerge
(
int8Max
),
avgMerge
(
int8Avg
),
sumMerge
(
int8Sum
)
FROM
testNullableStatesAgg
GROUP
BY
id
ORDER
BY
id
ASC
;
select
' ---- select row with nulls without states ---- '
;
SELECT
id
,
count
(),
min
(
string
),
max
(
string
),
floor
(
min
(
float64
),
5
),
floor
(
max
(
float64
),
5
),
floor
(
avg
(
float64
),
5
),
floor
(
sum
(
float64
),
5
),
floor
(
min
(
float32
),
5
),
floor
(
max
(
float32
),
5
),
floor
(
avg
(
float32
),
5
),
floor
(
sum
(
float32
),
5
),
min
(
decimal325
),
max
(
decimal325
),
avg
(
decimal325
),
sum
(
decimal325
),
min
(
date
),
max
(
date
),
min
(
datetime
),
max
(
datetime
),
min
(
datetime64
),
max
(
datetime64
),
min
(
int64
),
max
(
int64
),
avg
(
int64
),
sum
(
int64
),
min
(
int32
),
max
(
int32
),
avg
(
int32
),
sum
(
int32
),
min
(
int16
),
max
(
int16
),
avg
(
int16
),
sum
(
int16
),
min
(
int8
),
max
(
int8
),
avg
(
int8
),
sum
(
int8
)
FROM
testNullableStates
WHERE
id
=
'-2'
GROUP
BY
id
ORDER
BY
id
ASC
;
select
' ---- select row with nulls with states ---- '
;
SELECT
id
,
count
(),
minMerge
(
stringMin
),
maxMerge
(
stringMax
),
floor
(
minMerge
(
float64Min
),
5
),
floor
(
maxMerge
(
float64Max
),
5
),
floor
(
avgMerge
(
float64Avg
),
5
),
floor
(
sumMerge
(
float64Sum
),
5
),
floor
(
minMerge
(
float32Min
),
5
),
floor
(
maxMerge
(
float32Max
),
5
),
floor
(
avgMerge
(
float32Avg
),
5
),
floor
(
sumMerge
(
float32Sum
),
5
),
minMerge
(
decimal325Min
),
maxMerge
(
decimal325Max
),
avgMerge
(
decimal325Avg
),
sumMerge
(
decimal325Sum
),
minMerge
(
dateMin
),
maxMerge
(
dateMax
),
minMerge
(
datetimeMin
),
maxMerge
(
datetimeMax
),
minMerge
(
datetime64Min
),
maxMerge
(
datetime64Max
),
minMerge
(
int64Min
),
maxMerge
(
int64Max
),
avgMerge
(
int64Avg
),
sumMerge
(
int64Sum
),
minMerge
(
int32Min
),
maxMerge
(
int32Max
),
avgMerge
(
int32Avg
),
sumMerge
(
int32Sum
),
minMerge
(
int16Min
),
maxMerge
(
int16Max
),
avgMerge
(
int16Avg
),
sumMerge
(
int16Sum
),
minMerge
(
int8Min
),
maxMerge
(
int8Max
),
avgMerge
(
int8Avg
),
sumMerge
(
int8Sum
)
FROM
testNullableStatesAgg
WHERE
id
=
'-2'
GROUP
BY
id
ORDER
BY
id
ASC
;
select
' ---- select no rows without states ---- '
;
SELECT
count
(),
min
(
string
),
max
(
string
),
floor
(
min
(
float64
),
5
),
floor
(
max
(
float64
),
5
),
floor
(
avg
(
float64
),
5
),
floor
(
sum
(
float64
),
5
),
floor
(
min
(
float32
),
5
),
floor
(
max
(
float32
),
5
),
floor
(
avg
(
float32
),
5
),
floor
(
sum
(
float32
),
5
),
min
(
decimal325
),
max
(
decimal325
),
avg
(
decimal325
),
sum
(
decimal325
),
min
(
date
),
max
(
date
),
min
(
datetime
),
max
(
datetime
),
min
(
datetime64
),
max
(
datetime64
),
min
(
int64
),
max
(
int64
),
avg
(
int64
),
sum
(
int64
),
min
(
int32
),
max
(
int32
),
avg
(
int32
),
sum
(
int32
),
min
(
int16
),
max
(
int16
),
avg
(
int16
),
sum
(
int16
),
min
(
int8
),
max
(
int8
),
avg
(
int8
),
sum
(
int8
)
FROM
testNullableStates
WHERE
id
=
'-22'
;
select
' ---- select no rows with states ---- '
;
SELECT
count
(),
minMerge
(
stringMin
),
maxMerge
(
stringMax
),
floor
(
minMerge
(
float64Min
),
5
),
floor
(
maxMerge
(
float64Max
),
5
),
floor
(
avgMerge
(
float64Avg
),
5
),
floor
(
sumMerge
(
float64Sum
),
5
),
floor
(
minMerge
(
float32Min
),
5
),
floor
(
maxMerge
(
float32Max
),
5
),
floor
(
avgMerge
(
float32Avg
),
5
),
floor
(
sumMerge
(
float32Sum
),
5
),
minMerge
(
decimal325Min
),
maxMerge
(
decimal325Max
),
avgMerge
(
decimal325Avg
),
sumMerge
(
decimal325Sum
),
minMerge
(
dateMin
),
maxMerge
(
dateMax
),
minMerge
(
datetimeMin
),
maxMerge
(
datetimeMax
),
minMerge
(
datetime64Min
),
maxMerge
(
datetime64Max
),
minMerge
(
int64Min
),
maxMerge
(
int64Max
),
avgMerge
(
int64Avg
),
sumMerge
(
int64Sum
),
minMerge
(
int32Min
),
maxMerge
(
int32Max
),
avgMerge
(
int32Avg
),
sumMerge
(
int32Sum
),
minMerge
(
int16Min
),
maxMerge
(
int16Max
),
avgMerge
(
int16Avg
),
sumMerge
(
int16Sum
),
minMerge
(
int8Min
),
maxMerge
(
int8Max
),
avgMerge
(
int8Avg
),
sumMerge
(
int8Sum
)
FROM
testNullableStatesAgg
WHERE
id
=
'-22'
;
DROP
TABLE
testNullableStates
;
DROP
TABLE
testNullableStatesAgg
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录