Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
dcd86964
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,发现更多精彩内容 >>
提交
dcd86964
编写于
7月 16, 2019
作者:
D
Dmitry Rubashkin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor fixes
上级
4005987f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
22 deletion
+17
-22
dbms/src/Storages/MergeTree/MergeTreeIndexFullText.cpp
dbms/src/Storages/MergeTree/MergeTreeIndexFullText.cpp
+15
-22
dbms/src/Storages/MergeTree/MergeTreeIndexFullText.h
dbms/src/Storages/MergeTree/MergeTreeIndexFullText.h
+2
-0
未找到文件。
dbms/src/Storages/MergeTree/MergeTreeIndexFullText.cpp
浏览文件 @
dcd86964
...
...
@@ -49,7 +49,17 @@ static void likeStringToBloomFilter(
while
(
cur
<
data
.
size
()
&&
token_extractor
->
nextLike
(
data
,
&
cur
,
token
))
bloom_filter
.
add
(
token
.
c_str
(),
token
.
size
());
}
/// Unified condition for equals, startsWith and endsWith
bool
MergeTreeConditionFullText
::
createFunctionEqualsCondition
(
RPNElement
&
out
,
const
Field
&
value
,
const
MergeTreeIndexFullText
&
idx
)
{
out
.
function
=
RPNElement
::
FUNCTION_EQUALS
;
out
.
bloom_filter
=
std
::
make_unique
<
BloomFilter
>
(
idx
.
bloom_filter_size
,
idx
.
bloom_filter_hashes
,
idx
.
seed
);
const
auto
&
str
=
value
.
get
<
String
>
();
stringToBloomFilter
(
str
.
c_str
(),
str
.
size
(),
idx
.
token_extractor_func
,
*
out
.
bloom_filter
);
return
true
;
}
MergeTreeIndexGranuleFullText
::
MergeTreeIndexGranuleFullText
(
const
MergeTreeIndexFullText
&
index
)
:
IMergeTreeIndexGranule
()
...
...
@@ -129,13 +139,7 @@ const MergeTreeConditionFullText::AtomMap MergeTreeConditionFullText::atom_map
"equals"
,
[]
(
RPNElement
&
out
,
const
Field
&
value
,
const
MergeTreeIndexFullText
&
idx
)
{
out
.
function
=
RPNElement
::
FUNCTION_EQUALS
;
out
.
bloom_filter
=
std
::
make_unique
<
BloomFilter
>
(
idx
.
bloom_filter_size
,
idx
.
bloom_filter_hashes
,
idx
.
seed
);
const
auto
&
str
=
value
.
get
<
String
>
();
stringToBloomFilter
(
str
.
c_str
(),
str
.
size
(),
idx
.
token_extractor_func
,
*
out
.
bloom_filter
);
return
true
;
return
createFunctionEqualsCondition
(
out
,
value
,
idx
);
}
},
{
...
...
@@ -168,26 +172,14 @@ const MergeTreeConditionFullText::AtomMap MergeTreeConditionFullText::atom_map
"startsWith"
,
[]
(
RPNElement
&
out
,
const
Field
&
value
,
const
MergeTreeIndexFullText
&
idx
)
{
out
.
function
=
RPNElement
::
FUNCTION_EQUALS
;
out
.
bloom_filter
=
std
::
make_unique
<
BloomFilter
>
(
idx
.
bloom_filter_size
,
idx
.
bloom_filter_hashes
,
idx
.
seed
);
const
auto
&
prefix
=
value
.
get
<
String
>
();
stringToBloomFilter
(
prefix
.
c_str
(),
prefix
.
size
(),
idx
.
token_extractor_func
,
*
out
.
bloom_filter
);
return
true
;
return
createFunctionEqualsCondition
(
out
,
value
,
idx
);
}
},
{
"endsWith"
,
[]
(
RPNElement
&
out
,
const
Field
&
value
,
const
MergeTreeIndexFullText
&
idx
)
{
out
.
function
=
RPNElement
::
FUNCTION_EQUALS
;
out
.
bloom_filter
=
std
::
make_unique
<
BloomFilter
>
(
idx
.
bloom_filter_size
,
idx
.
bloom_filter_hashes
,
idx
.
seed
);
const
auto
&
suffix
=
value
.
get
<
String
>
();
stringToBloomFilter
(
suffix
.
c_str
(),
suffix
.
size
(),
idx
.
token_extractor_func
,
*
out
.
bloom_filter
);
return
true
;
return
createFunctionEqualsCondition
(
out
,
value
,
idx
);
}
},
{
...
...
@@ -196,6 +188,7 @@ const MergeTreeConditionFullText::AtomMap MergeTreeConditionFullText::atom_map
{
out
.
function
=
RPNElement
::
FUNCTION_MULTI_SEARCH
;
/// 2d vector is not needed here but is used because already exists for FUNCTION_IN
std
::
vector
<
std
::
vector
<
BloomFilter
>>
bloom_filters
;
bloom_filters
.
emplace_back
();
for
(
const
auto
&
element
:
value
.
get
<
Array
>
())
...
...
@@ -405,7 +398,7 @@ bool MergeTreeConditionFullText::atomFromAST(
size_t
key_arg_pos
;
/// Position of argument with key column (non-const argument)
size_t
key_column_num
=
-
1
;
/// Number of a key column (inside key_column_names array)
std
::
string
func_name
=
func
->
name
;
const
auto
&
func_name
=
func
->
name
;
if
(
functionIsInOrGlobalInOperator
(
func_name
)
&&
tryPrepareSetBloomFilter
(
args
,
out
))
{
...
...
dbms/src/Storages/MergeTree/MergeTreeIndexFullText.h
浏览文件 @
dcd86964
...
...
@@ -117,6 +117,8 @@ private:
bool
getKey
(
const
ASTPtr
&
node
,
size_t
&
key_column_num
);
bool
tryPrepareSetBloomFilter
(
const
ASTs
&
args
,
RPNElement
&
out
);
static
bool
createFunctionEqualsCondition
(
RPNElement
&
out
,
const
Field
&
value
,
const
MergeTreeIndexFullText
&
idx
);
static
const
AtomMap
atom_map
;
const
MergeTreeIndexFullText
&
index
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录