Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
76346c05
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,发现更多精彩内容 >>
提交
76346c05
编写于
11月 17, 2020
作者:
N
Nikolai Kochetov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove Converting transform and step.
上级
d9a83a60
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
59 addition
and
43 deletion
+59
-43
src/Functions/materialize.cpp
src/Functions/materialize.cpp
+1
-43
src/Functions/materialize.h
src/Functions/materialize.h
+46
-0
src/Interpreters/ActionsDAG.cpp
src/Interpreters/ActionsDAG.cpp
+12
-0
未找到文件。
src/Functions/materialize.cpp
浏览文件 @
76346c05
#include <Functions/IFunctionImpl.h>
#include <Functions/FunctionFactory.h>
#include <Functions/materialize.h>
namespace
DB
{
namespace
{
/** materialize(x) - materialize the constant
*/
class
FunctionMaterialize
:
public
IFunction
{
public:
static
constexpr
auto
name
=
"materialize"
;
static
FunctionPtr
create
(
const
Context
&
)
{
return
std
::
make_shared
<
FunctionMaterialize
>
();
}
bool
useDefaultImplementationForNulls
()
const
override
{
return
false
;
}
/// Get the function name.
String
getName
()
const
override
{
return
name
;
}
size_t
getNumberOfArguments
()
const
override
{
return
1
;
}
DataTypePtr
getReturnTypeImpl
(
const
DataTypes
&
arguments
)
const
override
{
return
arguments
[
0
];
}
ColumnPtr
executeImpl
(
ColumnsWithTypeAndName
&
arguments
,
const
DataTypePtr
&
,
size_t
/*input_rows_count*/
)
const
override
{
return
arguments
[
0
].
column
->
convertToFullColumnIfConst
();
}
};
}
void
registerFunctionMaterialize
(
FunctionFactory
&
factory
)
{
...
...
src/Functions/materialize.h
0 → 100644
浏览文件 @
76346c05
#pragma once
#include <Functions/IFunctionImpl.h>
#include <Functions/FunctionFactory.h>
namespace
DB
{
/** materialize(x) - materialize the constant
*/
class
FunctionMaterialize
:
public
IFunction
{
public:
static
constexpr
auto
name
=
"materialize"
;
static
FunctionPtr
create
(
const
Context
&
)
{
return
std
::
make_shared
<
FunctionMaterialize
>
();
}
bool
useDefaultImplementationForNulls
()
const
override
{
return
false
;
}
/// Get the function name.
String
getName
()
const
override
{
return
name
;
}
size_t
getNumberOfArguments
()
const
override
{
return
1
;
}
DataTypePtr
getReturnTypeImpl
(
const
DataTypes
&
arguments
)
const
override
{
return
arguments
[
0
];
}
ColumnPtr
executeImpl
(
ColumnsWithTypeAndName
&
arguments
,
const
DataTypePtr
&
,
size_t
/*input_rows_count*/
)
const
override
{
return
arguments
[
0
].
column
->
convertToFullColumnIfConst
();
}
};
}
src/Interpreters/ActionsDAG.cpp
浏览文件 @
76346c05
...
...
@@ -5,6 +5,7 @@
#include <Functions/IFunction.h>
#include <Functions/IFunctionAdaptors.h>
#include <Functions/FunctionsConversion.h>
#include <Functions/materialize.h>
#include <Interpreters/Context.h>
#include <Interpreters/ExpressionJIT.h>
#include <IO/WriteBufferFromString.h>
...
...
@@ -575,6 +576,11 @@ ActionsDAGPtr ActionsDAG::makeConvertingActions(
FunctionOverloadResolverPtr
func_builder_cast
=
std
::
make_shared
<
FunctionOverloadResolverAdaptor
>
(
CastOverloadResolver
::
createImpl
(
false
));
FunctionOverloadResolverPtr
func_builder_materialize
=
std
::
make_shared
<
FunctionOverloadResolverAdaptor
>
(
std
::
make_unique
<
DefaultOverloadResolver
>
(
std
::
make_shared
<
FunctionMaterialize
>
()));
std
::
map
<
std
::
string_view
,
std
::
list
<
size_t
>>
inputs
;
if
(
mode
==
MatchColumnsMode
::
Name
)
{
...
...
@@ -641,6 +647,12 @@ ActionsDAGPtr ActionsDAG::makeConvertingActions(
src_node
=
&
actions_dag
->
addFunction
(
func_builder_cast
,
std
::
move
(
children
),
{},
true
);
}
if
(
src_node
->
column
&&
isColumnConst
(
*
src_node
->
column
))
{
Inputs
children
=
{
src_node
};
src_node
=
&
actions_dag
->
addFunction
(
func_builder_materialize
,
std
::
move
(
children
),
{},
true
);
}
if
(
src_node
->
result_name
!=
res_elem
.
name
)
src_node
=
const_cast
<
Node
*>
(
&
actions_dag
->
addAlias
(
src_node
->
result_name
,
res_elem
.
name
,
true
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录