Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
06fe7f6a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
06fe7f6a
编写于
7月 10, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test case
上级
f52038db
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
15 deletion
+25
-15
source/libs/index/inc/indexFstDfa.h
source/libs/index/inc/indexFstDfa.h
+1
-1
source/libs/index/src/indexFstDfa.c
source/libs/index/src/indexFstDfa.c
+5
-7
source/libs/index/src/indexFstRegex.c
source/libs/index/src/indexFstRegex.c
+5
-2
source/libs/index/src/indexFstSparse.c
source/libs/index/src/indexFstSparse.c
+10
-4
source/libs/index/test/fstUtilUT.cc
source/libs/index/test/fstUtilUT.cc
+4
-1
未找到文件。
source/libs/index/inc/indexFstDfa.h
浏览文件 @
06fe7f6a
...
...
@@ -51,7 +51,7 @@ FstDfa *dfaBuilderBuild(FstDfaBuilder *builder);
bool
dfaBuilderRunState
(
FstDfaBuilder
*
builder
,
FstSparseSet
*
cur
,
FstSparseSet
*
next
,
uint32_t
state
,
uint8_t
bytes
,
uint32_t
*
result
);
bool
dfaBuilderCache
d
State
(
FstDfaBuilder
*
builder
,
FstSparseSet
*
set
,
uint32_t
*
result
);
bool
dfaBuilderCacheState
(
FstDfaBuilder
*
builder
,
FstSparseSet
*
set
,
uint32_t
*
result
);
/*
* dfa related func
...
...
source/libs/index/src/indexFstDfa.c
浏览文件 @
06fe7f6a
...
...
@@ -64,7 +64,7 @@ void dfaBuilderDestroy(FstDfaBuilder *builder) {
taosMemoryFree
(
builder
);
}
FstDfa
*
dfaBuilder
(
FstDfaBuilder
*
builder
)
{
FstDfa
*
dfaBuilder
Build
(
FstDfaBuilder
*
builder
)
{
uint32_t
sz
=
taosArrayGetSize
(
builder
->
dfa
->
insts
);
FstSparseSet
*
cur
=
sparSetCreate
(
sz
);
FstSparseSet
*
nxt
=
sparSetCreate
(
sz
);
...
...
@@ -73,7 +73,7 @@ FstDfa *dfaBuilder(FstDfaBuilder *builder) {
SArray
*
states
=
taosArrayInit
(
0
,
sizeof
(
uint32_t
));
uint32_t
result
;
if
(
dfaBuilderCache
d
State
(
builder
,
cur
,
&
result
))
{
if
(
dfaBuilderCacheState
(
builder
,
cur
,
&
result
))
{
taosArrayPush
(
states
,
&
result
);
}
SHashObj
*
seen
=
taosHashInit
(
12
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
false
,
HASH_NO_LOCK
);
...
...
@@ -98,8 +98,6 @@ FstDfa *dfaBuilder(FstDfaBuilder *builder) {
return
builder
->
dfa
;
}
FstDfa
*
dfaBuilderBuild
(
FstDfaBuilder
*
builer
)
{
return
NULL
;
}
bool
dfaBuilderRunState
(
FstDfaBuilder
*
builder
,
FstSparseSet
*
cur
,
FstSparseSet
*
next
,
uint32_t
state
,
uint8_t
byte
,
uint32_t
*
result
)
{
sparSetClear
(
cur
);
...
...
@@ -114,7 +112,7 @@ bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet
t
=
taosArrayGet
(
builder
->
dfa
->
states
,
state
);
uint32_t
nxtState
;
if
(
dfaBuilderCache
d
State
(
builder
,
next
,
&
nxtState
))
{
if
(
dfaBuilderCacheState
(
builder
,
next
,
&
nxtState
))
{
t
->
next
[
byte
]
=
nxtState
;
*
result
=
nxtState
;
return
true
;
...
...
@@ -122,7 +120,7 @@ bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet
return
false
;
}
bool
dfaBuilderCache
d
State
(
FstDfaBuilder
*
builder
,
FstSparseSet
*
set
,
uint32_t
*
result
)
{
bool
dfaBuilderCacheState
(
FstDfaBuilder
*
builder
,
FstSparseSet
*
set
,
uint32_t
*
result
)
{
SArray
*
tinsts
=
taosArrayInit
(
4
,
sizeof
(
uint32_t
));
bool
isMatch
=
false
;
...
...
@@ -190,7 +188,7 @@ void dfaAdd(FstDfa *dfa, FstSparseSet *set, uint32_t ip) {
return
;
}
bool
succ
=
sparSetAdd
(
set
,
ip
,
NULL
);
assert
(
succ
==
true
);
//
assert(succ == true);
Inst
*
inst
=
taosArrayGet
(
dfa
->
insts
,
ip
);
if
(
inst
->
ty
==
MATCH
||
inst
->
ty
==
RANGE
)
{
// do nothing
...
...
source/libs/index/src/indexFstRegex.c
浏览文件 @
06fe7f6a
...
...
@@ -29,8 +29,11 @@ FstRegex *regexCreate(const char *str) {
regex
->
orig
=
orig
;
// construct insts based on str
SArray
*
insts
=
NULL
;
SArray
*
insts
=
taosArrayInit
(
256
,
sizeof
(
uint8_t
));
for
(
int
i
=
0
;
i
<
strlen
(
str
);
i
++
)
{
uint8_t
v
=
str
[
i
];
taosArrayPush
(
insts
,
&
v
);
}
FstDfaBuilder
*
builder
=
dfaBuilderCreate
(
insts
);
regex
->
dfa
=
dfaBuilderBuild
(
builder
);
return
regex
;
...
...
source/libs/index/src/indexFstSparse.c
浏览文件 @
06fe7f6a
...
...
@@ -15,6 +15,11 @@
#include "indexFstSparse.h"
static
void
sparSetUtil
(
int32_t
*
buf
,
int32_t
cap
)
{
for
(
int32_t
i
=
0
;
i
<
cap
;
i
++
)
{
buf
[
i
]
=
-
1
;
}
}
FstSparseSet
*
sparSetCreate
(
int32_t
sz
)
{
FstSparseSet
*
ss
=
taosMemoryCalloc
(
1
,
sizeof
(
FstSparseSet
));
if
(
ss
==
NULL
)
{
...
...
@@ -22,9 +27,10 @@ FstSparseSet *sparSetCreate(int32_t sz) {
}
ss
->
dense
=
(
int32_t
*
)
taosMemoryMalloc
(
sz
*
sizeof
(
int32_t
));
memset
(
ss
->
dense
,
-
1
,
sz
*
sizeof
(
int32_t
));
ss
->
sparse
=
(
int32_t
*
)
taosMemoryMalloc
(
sz
*
sizeof
(
int32_t
));
memset
(
ss
->
sparse
,
-
1
,
sz
*
sizeof
(
int32_t
));
sparSetUtil
(
ss
->
dense
,
sz
);
sparSetUtil
(
ss
->
sparse
,
sz
);
ss
->
cap
=
sz
;
ss
->
size
=
0
;
...
...
@@ -84,7 +90,7 @@ void sparSetClear(FstSparseSet *ss) {
if
(
ss
==
NULL
)
{
return
;
}
memset
(
ss
->
dense
,
-
1
,
ss
->
cap
*
sizeof
(
int32_t
)
);
memset
(
ss
->
sparse
,
-
1
,
ss
->
cap
*
sizeof
(
int32_t
)
);
sparSetUtil
(
ss
->
dense
,
ss
->
cap
);
sparSetUtil
(
ss
->
sparse
,
ss
->
cap
);
ss
->
size
=
0
;
}
source/libs/index/test/fstUtilUT.cc
浏览文件 @
06fe7f6a
...
...
@@ -66,7 +66,10 @@ TEST_F(FstUtilEnv, test4) {
// test FstRegex
TEST_F
(
FstRegexEnv
,
test1
)
{}
TEST_F
(
FstRegexEnv
,
test1
)
{
//
EXPECT_EQ
(
regex
!=
NULL
,
true
);
}
TEST_F
(
FstRegexEnv
,
test2
)
{}
TEST_F
(
FstRegexEnv
,
test3
)
{}
TEST_F
(
FstRegexEnv
,
test4
)
{}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录