Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
06fe44ca
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
06fe44ca
编写于
11月 22, 2021
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add compare
上级
0bbe42df
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
6 deletion
+42
-6
source/libs/index/inc/index_fst.h
source/libs/index/inc/index_fst.h
+1
-1
source/libs/index/inc/index_fst_util.h
source/libs/index/inc/index_fst_util.h
+2
-0
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+21
-5
source/libs/index/src/index_fst_util.c
source/libs/index/src/index_fst_util.c
+18
-0
未找到文件。
source/libs/index/inc/index_fst.h
浏览文件 @
06fe44ca
...
@@ -94,7 +94,7 @@ typedef struct FstBuilderNodeUnfinished {
...
@@ -94,7 +94,7 @@ typedef struct FstBuilderNodeUnfinished {
}
FstBuilderNodeUnfinished
;
}
FstBuilderNodeUnfinished
;
void
fstBuilderNodeUnfinishedLastCompiled
(
FstBuilderNodeUnfinished
*
node
,
CompiledAddr
addr
);
void
fstBuilderNodeUnfinishedLastCompiled
(
FstBuilderNodeUnfinished
*
node
,
CompiledAddr
addr
);
void
fstBuilderNodeUnfinishedAddOutputPrefix
(
FstBuilderNodeUnfinished
*
node
,
CompiledAddr
addr
);
void
fstBuilderNodeUnfinishedAddOutputPrefix
(
FstBuilderNodeUnfinished
*
node
,
Output
out
);
/*
/*
* FstNode and helper function
* FstNode and helper function
...
...
source/libs/index/inc/index_fst_util.h
浏览文件 @
06fe44ca
...
@@ -78,5 +78,7 @@ FstSlice fstSliceCopy(FstSlice *slice, uint32_t start, uint32_t end);
...
@@ -78,5 +78,7 @@ FstSlice fstSliceCopy(FstSlice *slice, uint32_t start, uint32_t end);
FstSlice
fstSliceCreate
(
uint8_t
*
data
,
uint64_t
dLen
);
FstSlice
fstSliceCreate
(
uint8_t
*
data
,
uint64_t
dLen
);
bool
fstSliceEmpty
(
FstSlice
*
slice
);
bool
fstSliceEmpty
(
FstSlice
*
slice
);
int
fstSliceCompare
(
FstSlice
*
a
,
FstSlice
*
b
);
#endif
#endif
source/libs/index/src/index_fst.c
浏览文件 @
06fe44ca
...
@@ -307,10 +307,10 @@ FstBuilder *fstBuilderCreate(void *w, FstType ty) {
...
@@ -307,10 +307,10 @@ FstBuilder *fstBuilderCreate(void *w, FstType ty) {
}
}
void
fstBuilderCheckLastKey
(
FstBuilder
*
b
,
FstSlice
bs
,
bool
ckDupe
)
{
bool
fstBuilderCheckLastKey
(
FstBuilder
*
b
,
FstSlice
bs
,
bool
ckDupe
)
{
return
;
return
true
;
}
}
CompiledAddr
fstBuilderCompile
(
FstBuilder
*
b
,
FstBuilderNode
*
bn
)
{
CompiledAddr
fstBuilderCompile
(
FstBuilder
*
b
,
FstBuilderNode
*
bn
)
{
if
(
FST_BUILDER_NODE_IS_FINAL
(
bn
)
if
(
FST_BUILDER_NODE_IS_FINAL
(
bn
)
&&
FST_BUILDER_NODE_TRANS_ISEMPTY
(
bn
)
&&
FST_BUILDER_NODE_TRANS_ISEMPTY
(
bn
)
...
@@ -336,6 +336,8 @@ CompiledAddr fstBuilderCompile(FstBuilder *b, FstBuilderNode *bn) {
...
@@ -336,6 +336,8 @@ CompiledAddr fstBuilderCompile(FstBuilder *b, FstBuilderNode *bn) {
}
}
FstSlice
fstNodeAsSlice
(
FstNode
*
node
)
{
FstSlice
fstNodeAsSlice
(
FstNode
*
node
)
{
FstSlice
*
slice
=
&
node
->
data
;
FstSlice
*
slice
=
&
node
->
data
;
FstSlice
s
=
fstSliceCopy
(
slice
,
slice
->
end
,
slice
->
dLen
-
1
);
FstSlice
s
=
fstSliceCopy
(
slice
,
slice
->
end
,
slice
->
dLen
-
1
);
...
@@ -354,11 +356,25 @@ FstLastTransition *fstLastTransitionCreate(uint8_t inp, Output out) {
...
@@ -354,11 +356,25 @@ FstLastTransition *fstLastTransitionCreate(uint8_t inp, Output out) {
void
fstLastTransitionDestroy
(
FstLastTransition
*
trn
)
{
void
fstLastTransitionDestroy
(
FstLastTransition
*
trn
)
{
free
(
trn
);
free
(
trn
);
}
}
void
fstBuilderNodeUnfinishedLastCompiled
(
FstBuilderNodeUnfinished
*
node
,
CompiledAddr
addr
)
{
void
fstBuilderNodeUnfinishedLastCompiled
(
FstBuilderNodeUnfinished
*
unNode
,
CompiledAddr
addr
)
{
FstLastTransition
*
trn
=
unNode
->
last
;
FstTransition
t
=
{.
inp
=
trn
->
inp
,
.
out
=
trn
->
out
,
.
addr
=
addr
};
taosArrayPush
(
unNode
->
node
->
trans
,
&
t
);
return
;
return
;
}
}
void
fstBuilderNodeUnfinishedAddOutputPrefix
(
FstBuilderNodeUnfinished
*
node
,
CompiledAddr
addr
)
{
void
fstBuilderNodeUnfinishedAddOutputPrefix
(
FstBuilderNodeUnfinished
*
unNode
,
Output
out
)
{
if
(
FST_BUILDER_NODE_IS_FINAL
(
unNode
->
node
))
{
unNode
->
node
->
finalOutput
+=
out
;
}
size_t
sz
=
taosArrayGetSize
(
unNode
->
node
->
trans
);
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
FstTransition
*
trn
=
taosArrayGet
(
unNode
->
node
->
trans
,
i
);
trn
->
out
+=
out
;
}
if
(
unNode
->
last
)
{
unNode
->
last
->
out
+=
out
;
}
return
;
return
;
}
}
...
...
source/libs/index/src/index_fst_util.c
浏览文件 @
06fe44ca
...
@@ -113,3 +113,21 @@ bool fstSliceEmpty(FstSlice *slice) {
...
@@ -113,3 +113,21 @@ bool fstSliceEmpty(FstSlice *slice) {
int
fstSliceCompare
(
FstSlice
*
a
,
FstSlice
*
b
)
{
uint32_t
aLen
=
(
a
->
end
-
a
->
start
+
1
);
uint32_t
bLen
=
(
b
->
end
-
b
->
start
+
1
);
uint32_t
mLen
=
(
aLen
<
bLen
?
aLen
:
bLen
);
for
(
int
i
=
0
;
i
<
mLen
;
i
++
)
{
uint8_t
x
=
a
->
data
[
i
+
a
->
start
];
uint8_t
y
=
b
->
data
[
i
+
b
->
start
];
if
(
x
==
y
)
{
continue
;
}
else
if
(
x
<
y
)
{
return
-
1
;
}
else
{
return
1
;
}
}
if
(
aLen
==
bLen
)
{
return
0
;
}
else
if
(
aLen
<
bLen
)
{
return
-
1
;
}
else
{
return
1
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录