Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
ee1b4a1a
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,发现更多精彩内容 >>
未验证
提交
ee1b4a1a
编写于
4月 14, 2020
作者:
A
Artem Zuikov
提交者:
GitHub
4月 14, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix and improve OneTypeMatcher (#10253)
上级
88e492df
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
13 deletion
+23
-13
src/Interpreters/CrossToInnerJoinVisitor.cpp
src/Interpreters/CrossToInnerJoinVisitor.cpp
+1
-1
src/Interpreters/InDepthNodeVisitor.h
src/Interpreters/InDepthNodeVisitor.h
+13
-11
src/Interpreters/PredicateRewriteVisitor.h
src/Interpreters/PredicateRewriteVisitor.h
+9
-1
未找到文件。
src/Interpreters/CrossToInnerJoinVisitor.cpp
浏览文件 @
ee1b4a1a
...
...
@@ -214,7 +214,7 @@ private:
}
};
using
CheckExpressionMatcher
=
ConstOneTypeMatcher
<
CheckExpressionVisitorData
,
fals
e
>
;
using
CheckExpressionMatcher
=
ConstOneTypeMatcher
<
CheckExpressionVisitorData
,
NeedChild
::
non
e
>
;
using
CheckExpressionVisitor
=
ConstInDepthNodeVisitor
<
CheckExpressionMatcher
,
true
>
;
...
...
src/Interpreters/InDepthNodeVisitor.h
浏览文件 @
ee1b4a1a
...
...
@@ -51,21 +51,23 @@ private:
template
<
typename
Matcher
,
bool
top_to_bottom
>
using
ConstInDepthNodeVisitor
=
InDepthNodeVisitor
<
Matcher
,
top_to_bottom
,
const
ASTPtr
>
;
/// Simple matcher for one node type without complex traversal logic.
template
<
typename
Data_
,
bool
visit_children
=
true
,
typename
T
=
ASTPtr
>
struct
NeedChild
{
using
Condition
=
bool
(
*
)(
const
ASTPtr
&
node
,
const
ASTPtr
&
child
);
static
bool
all
(
const
ASTPtr
&
,
const
ASTPtr
&
)
{
return
true
;
}
static
bool
none
(
const
ASTPtr
&
,
const
ASTPtr
&
)
{
return
false
;
}
};
/// Simple matcher for one node type. Use need_child function for complex traversal logic.
template
<
typename
Data_
,
NeedChild
::
Condition
need_child
=
NeedChild
::
all
,
typename
T
=
ASTPtr
>
class
OneTypeMatcher
{
public:
using
Data
=
Data_
;
using
TypeToVisit
=
typename
Data
::
TypeToVisit
;
static
bool
needChildVisit
(
const
ASTPtr
&
node
,
const
ASTPtr
&
)
{
if
(
node
&&
node
->
as
<
TypeToVisit
>
())
return
visit_children
;
return
true
;
}
static
bool
needChildVisit
(
const
ASTPtr
&
node
,
const
ASTPtr
&
child
)
{
return
need_child
(
node
,
child
);
}
static
void
visit
(
T
&
ast
,
Data
&
data
)
{
...
...
@@ -74,7 +76,7 @@ public:
}
};
template
<
typename
Data
,
bool
visit_children
=
true
>
using
ConstOneTypeMatcher
=
OneTypeMatcher
<
Data
,
visit_children
,
const
ASTPtr
>
;
template
<
typename
Data
,
NeedChild
::
Condition
need_child
=
NeedChild
::
all
>
using
ConstOneTypeMatcher
=
OneTypeMatcher
<
Data
,
need_child
,
const
ASTPtr
>
;
}
src/Interpreters/PredicateRewriteVisitor.h
浏览文件 @
ee1b4a1a
...
...
@@ -16,6 +16,14 @@ public:
void
visit
(
ASTSelectWithUnionQuery
&
union_select_query
,
ASTPtr
&
);
static
bool
needChild
(
const
ASTPtr
&
node
,
const
ASTPtr
&
)
{
if
(
node
&&
node
->
as
<
TypeToVisit
>
())
return
false
;
return
true
;
}
PredicateRewriteVisitorData
(
const
Context
&
context_
,
const
ASTs
&
predicates_
,
const
Names
&
column_names_
,
bool
optimize_final_
);
private:
...
...
@@ -31,6 +39,6 @@ private:
bool
rewriteSubquery
(
ASTSelectQuery
&
subquery
,
const
Names
&
outer_columns
,
const
Names
&
inner_columns
);
};
using
PredicateRewriteMatcher
=
OneTypeMatcher
<
PredicateRewriteVisitorData
,
false
>
;
using
PredicateRewriteMatcher
=
OneTypeMatcher
<
PredicateRewriteVisitorData
,
PredicateRewriteVisitorData
::
needChild
>
;
using
PredicateRewriteVisitor
=
InDepthNodeVisitor
<
PredicateRewriteMatcher
,
true
>
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录