Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
c08fce3e
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,发现更多精彩内容 >>
提交
c08fce3e
编写于
3月 26, 2020
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--amend fixed string LIKE: initial implementation
上级
8c0aa1bd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
24 deletion
+29
-24
dbms/src/Functions/FunctionsStringRegex.cpp
dbms/src/Functions/FunctionsStringRegex.cpp
+28
-23
dbms/src/Functions/FunctionsStringSearch.h
dbms/src/Functions/FunctionsStringSearch.h
+1
-1
未找到文件。
dbms/src/Functions/FunctionsStringRegex.cpp
浏览文件 @
c08fce3e
...
...
@@ -259,6 +259,9 @@ struct MatchImpl
const
UInt8
*
pos
=
begin
;
const
UInt8
*
end
=
pos
+
data
.
size
();
size_t
i
=
0
;
const
UInt8
*
next_pos
=
begin
;
/// If pattern is larger than string size - it cannot be found.
if
(
strstr_pattern
.
size
()
<=
n
)
{
...
...
@@ -268,26 +271,26 @@ struct MatchImpl
while
(
pos
<
end
&&
end
!=
(
pos
=
searcher
.
search
(
pos
,
end
-
pos
)))
{
/// Let's determine which index it refers to.
size_t
i
=
(
pos
-
begin
)
/
n
;
while
(
next_pos
+
n
<=
pos
)
{
res
[
i
]
=
revert
;
next_pos
+=
n
;
++
i
;
}
/// We check that the entry does not pass through the boundaries of strings.
auto
next
=
begin
+
(
i
+
1
)
*
n
;
if
(
pos
+
strstr_pattern
.
size
()
<
next
)
if
(
pos
+
strstr_pattern
.
size
()
<
next_pos
)
res
[
i
]
=
!
revert
;
else
res
[
i
]
=
revert
;
pos
=
next
;
pos
=
next
_pos
;
}
}
/// Tail, in which there can be no substring.
{
size_t
i
=
(
pos
-
begin
)
/
n
;
if
(
i
<
res
.
size
())
memset
(
&
res
[
i
],
revert
,
(
res
.
size
()
-
i
)
*
sizeof
(
res
[
0
]));
}
if
(
i
<
res
.
size
())
memset
(
&
res
[
i
],
revert
,
(
res
.
size
()
-
i
)
*
sizeof
(
res
[
0
]));
}
else
{
...
...
@@ -334,6 +337,9 @@ struct MatchImpl
const
UInt8
*
pos
=
begin
;
const
UInt8
*
end
=
pos
+
data
.
size
();
size_t
i
=
0
;
const
UInt8
*
next_pos
=
begin
;
/// If required substring is larger than string size - it cannot be found.
if
(
strstr_pattern
.
size
()
<=
n
)
{
...
...
@@ -342,13 +348,15 @@ struct MatchImpl
/// We will search for the next occurrence in all rows at once.
while
(
pos
<
end
&&
end
!=
(
pos
=
searcher
.
search
(
pos
,
end
-
pos
)))
{
/// Determine which index it refers to.
size_t
i
=
(
pos
-
begin
)
/
n
;
/// We check that the entry does not pass through the boundaries of strings.
auto
next
=
begin
+
(
i
+
1
)
*
n
;
/// Let's determine which index it refers to.
while
(
next_pos
+
n
<=
pos
)
{
res
[
i
]
=
revert
;
next_pos
+=
n
;
++
i
;
}
if
(
pos
+
strstr_pattern
.
size
()
<
next
)
if
(
pos
+
strstr_pattern
.
size
()
<
next
_pos
)
{
/// And if it does not, if necessary, we check the regexp.
...
...
@@ -356,7 +364,7 @@ struct MatchImpl
res
[
i
]
=
!
revert
;
else
{
const
char
*
str_data
=
reinterpret_cast
<
const
char
*>
(
begin
+
i
*
n
);
const
char
*
str_data
=
reinterpret_cast
<
const
char
*>
(
next_pos
-
n
);
/** Even in the case of `required_substring_is_prefix` use UNANCHORED check for regexp,
* so that it can match when `required_substring` occurs into the string several times,
...
...
@@ -381,16 +389,13 @@ struct MatchImpl
else
res
[
i
]
=
revert
;
pos
=
next
;
pos
=
next
_pos
;
}
}
/// Tail, in which there can be no substring.
{
size_t
i
=
(
pos
-
begin
)
/
n
;
if
(
i
<
res
.
size
())
memset
(
&
res
[
i
],
revert
,
(
res
.
size
()
-
i
)
*
sizeof
(
res
[
0
]));
}
if
(
i
<
res
.
size
())
memset
(
&
res
[
i
],
revert
,
(
res
.
size
()
-
i
)
*
sizeof
(
res
[
0
]));
}
}
}
...
...
dbms/src/Functions/FunctionsStringSearch.h
浏览文件 @
c08fce3e
...
...
@@ -95,7 +95,7 @@ public:
DataTypePtr
getReturnTypeImpl
(
const
DataTypes
&
arguments
)
const
override
{
if
(
!
isString
(
arguments
[
0
]))
if
(
!
isString
OrFixedString
(
arguments
[
0
]))
throw
Exception
(
"Illegal type "
+
arguments
[
0
]
->
getName
()
+
" of argument of function "
+
getName
(),
ErrorCodes
::
ILLEGAL_TYPE_OF_ARGUMENT
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录