Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
6d93d9ce
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,发现更多精彩内容 >>
提交
6d93d9ce
编写于
5月 03, 2017
作者:
V
Vitaliy Lyudvichenko
提交者:
alexey-milovidov
5月 03, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Combinator -MergeState now returns AggregateFunction(nested_func). [#CLICKHOUSE-2891]
上级
713168c9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
53 addition
and
4 deletion
+53
-4
dbms/src/AggregateFunctions/AggregateFunctionMerge.h
dbms/src/AggregateFunctions/AggregateFunctionMerge.h
+5
-0
dbms/src/AggregateFunctions/AggregateFunctionState.cpp
dbms/src/AggregateFunctions/AggregateFunctionState.cpp
+26
-0
dbms/src/AggregateFunctions/AggregateFunctionState.h
dbms/src/AggregateFunctions/AggregateFunctionState.h
+2
-4
dbms/tests/queries/0_stateless/00432_aggregate_function_scalars_and_constants.reference
.../00432_aggregate_function_scalars_and_constants.reference
+3
-0
dbms/tests/queries/0_stateless/00432_aggregate_function_scalars_and_constants.sql
...teless/00432_aggregate_function_scalars_and_constants.sql
+17
-0
未找到文件。
dbms/src/AggregateFunctions/AggregateFunctionMerge.h
浏览文件 @
6d93d9ce
...
...
@@ -34,6 +34,11 @@ public:
return
nested_func
->
getReturnType
();
}
AggregateFunctionPtr
getNestedFunction
()
const
{
return
nested_func_owner
;
}
void
setArguments
(
const
DataTypes
&
arguments
)
override
{
if
(
arguments
.
size
()
!=
1
)
...
...
dbms/src/AggregateFunctions/AggregateFunctionState.cpp
浏览文件 @
6d93d9ce
#include <AggregateFunctions/AggregateFunctionState.h>
#include <AggregateFunctions/AggregateFunctionMerge.h>
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
BAD_ARGUMENTS
;
}
DataTypePtr
AggregateFunctionState
::
getReturnType
()
const
{
auto
ptr
=
std
::
make_shared
<
DataTypeAggregateFunction
>
(
nested_func_owner
,
arguments
,
params
);
/// Special case: it is -MergeState combinator
if
(
typeid_cast
<
const
AggregateFunctionMerge
*>
(
ptr
->
getFunction
().
get
()))
{
if
(
arguments
.
size
()
!=
1
)
throw
Exception
(
"Combinator -MergeState expects only one argument"
,
ErrorCodes
::
BAD_ARGUMENTS
);
if
(
!
typeid_cast
<
const
DataTypeAggregateFunction
*>
(
arguments
[
0
].
get
()))
throw
Exception
(
"Combinator -MergeState expects argument with AggregateFunction type"
,
ErrorCodes
::
BAD_ARGUMENTS
);
return
arguments
[
0
];
}
return
ptr
;
}
AggregateFunctionPtr
createAggregateFunctionState
(
AggregateFunctionPtr
&
nested
)
{
return
std
::
make_shared
<
AggregateFunctionState
>
(
nested
);
...
...
dbms/src/AggregateFunctions/AggregateFunctionState.h
浏览文件 @
6d93d9ce
#pragma once
#include <DataTypes/DataTypeAggregateFunction.h>
...
...
@@ -30,10 +31,7 @@ public:
return
nested_func
->
getName
()
+
"State"
;
}
DataTypePtr
getReturnType
()
const
override
{
return
std
::
make_shared
<
DataTypeAggregateFunction
>
(
nested_func_owner
,
arguments
,
params
);
}
DataTypePtr
getReturnType
()
const
override
;
void
setArguments
(
const
DataTypes
&
arguments_
)
override
{
...
...
dbms/tests/queries/0_stateless/00432_aggregate_function_scalars_and_constants.reference
浏览文件 @
6d93d9ce
...
...
@@ -27,3 +27,6 @@
1
0
1
2
dbms/tests/queries/0_stateless/00432_aggregate_function_scalars_and_constants.sql
浏览文件 @
6d93d9ce
...
...
@@ -38,3 +38,20 @@ SELECT arrayReduce('groupUniqArrayMergeIf',
SELECT
''
;
SELECT
arrayReduce
(
'avgState'
,
[
0
])
IN
(
arrayReduce
(
'avgState'
,
[
0
,
1
]),
arrayReduce
(
'avgState'
,
[
0
]));
SELECT
arrayReduce
(
'avgState'
,
[
0
])
IN
(
arrayReduce
(
'avgState'
,
[
0
,
1
]),
arrayReduce
(
'avgState'
,
[
1
]));
SELECT
''
;
SELECT
arrayReduce
(
'uniqExactMerge'
,
[
arrayReduce
(
'uniqExactMergeState'
,
[
arrayReduce
(
'uniqExactState'
,
[
12345678901
]),
arrayReduce
(
'uniqExactState'
,
[
12345678901
])
])
]);
SELECT
arrayReduce
(
'uniqExactMerge'
,
[
arrayReduce
(
'uniqExactMergeState'
,
[
arrayReduce
(
'uniqExactState'
,
[
12345678901
]),
arrayReduce
(
'uniqExactState'
,
[
12345678902
])
])
]);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录