Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e3ccb28c
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看板
提交
e3ccb28c
编写于
12月 02, 2021
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update fst write
上级
716c0045
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
20 addition
and
13 deletion
+20
-13
source/libs/index/inc/index_fst.h
source/libs/index/inc/index_fst.h
+3
-5
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+12
-2
source/libs/index/src/index_fst_util.c
source/libs/index/src/index_fst_util.c
+5
-6
未找到文件。
source/libs/index/inc/index_fst.h
浏览文件 @
e3ccb28c
...
...
@@ -268,9 +268,6 @@ FstNode* fstGetNode(Fst *fst, CompiledAddr);
FstNode
*
fstGetRoot
(
Fst
*
fst
);
FstType
fstGetType
(
Fst
*
fst
);
CompiledAddr
fstGetRootAddr
(
Fst
*
fst
);
Output
fstEmptyFinalOutput
(
Fst
*
fst
,
bool
*
null
);
bool
fstVerify
(
Fst
*
fst
);
...
...
@@ -304,6 +301,7 @@ typedef struct StreamWithStateResult {
}
StreamWithStateResult
;
StreamWithStateResult
*
swsResultCreate
(
FstSlice
*
data
,
FstOutput
fOut
,
void
*
state
);
void
swsResultDestroy
(
StreamWithStateResult
*
result
);
typedef
void
*
(
*
StreamCallback
)(
void
*
);
StreamWithState
*
streamWithStateCreate
(
Fst
*
fst
,
Automation
*
automation
,
FstBoundWithData
*
min
,
FstBoundWithData
*
max
)
;
...
...
source/libs/index/src/index_fst.c
浏览文件 @
e3ccb28c
...
...
@@ -1301,12 +1301,16 @@ StreamWithStateResult *streamWithStateNextWith(StreamWithState *sws, StreamCallb
if
(
fstBoundWithDataExceededBy
(
sws
->
endAt
,
&
slice
))
{
taosArrayDestroyEx
(
sws
->
stack
,
streamStateDestroy
);
sws
->
stack
=
(
SArray
*
)
taosArrayInit
(
256
,
sizeof
(
StreamState
));
fstSliceDestroy
(
&
slice
);
return
NULL
;
}
if
(
FST_NODE_IS_FINAL
(
nextNode
)
&&
isMatch
)
{
FstOutput
fOutput
=
{.
null
=
false
,
.
out
=
out
+
FST_NODE_FINAL_OUTPUT
(
nextNode
)};
return
swsResultCreate
(
&
slice
,
fOutput
,
tState
);
StreamWithStateResult
*
result
=
swsResultCreate
(
&
slice
,
fOutput
,
tState
);
fstSliceDestroy
(
&
slice
);
return
result
;
}
fstSliceDestroy
(
&
slice
);
}
return
NULL
;
...
...
@@ -1321,8 +1325,14 @@ StreamWithStateResult *swsResultCreate(FstSlice *data, FstOutput fOut, void *sta
result
->
state
=
state
;
return
result
;
}
void
swsResultDestroy
(
StreamWithStateResult
*
result
)
{
if
(
NULL
==
result
)
{
return
;
}
fstSliceDestroy
(
&
result
->
data
);
free
(
result
);
}
void
streamStateDestroy
(
void
*
s
)
{
if
(
NULL
==
s
)
{
return
;
}
StreamState
*
ss
=
(
StreamState
*
)
s
;
...
...
source/libs/index/src/index_fst_util.c
浏览文件 @
e3ccb28c
...
...
@@ -107,7 +107,6 @@ FstSlice fstSliceCreate(uint8_t *data, uint64_t len) {
FstSlice
fstSliceCopy
(
FstSlice
*
s
,
int32_t
start
,
int32_t
end
)
{
FstString
*
str
=
s
->
str
;
str
->
ref
++
;
int32_t
alen
;
//uint8_t *buf = fstSliceData(s, &alen);
//start = buf + start - (buf - s->start);
//end = buf + end - (buf - s->start);
...
...
@@ -117,9 +116,10 @@ FstSlice fstSliceCopy(FstSlice *s, int32_t start, int32_t end) {
}
FstSlice
fstSliceDeepCopy
(
FstSlice
*
s
,
int32_t
start
,
int32_t
end
)
{
int32_t
alen
,
tlen
=
end
-
start
+
1
;
uint8_t
*
data
=
fstSliceData
(
s
,
&
alen
);
assert
(
tlen
<=
alen
);
int32_t
tlen
=
end
-
start
+
1
;
int32_t
slen
;
uint8_t
*
data
=
fstSliceData
(
s
,
&
slen
);
assert
(
tlen
<=
slen
);
uint8_t
*
buf
=
malloc
(
sizeof
(
uint8_t
)
*
tlen
);
memcpy
(
buf
,
data
+
start
,
tlen
);
...
...
@@ -136,7 +136,7 @@ FstSlice fstSliceDeepCopy(FstSlice *s, int32_t start, int32_t end) {
return
ans
;
}
bool
fstSliceIsEmpty
(
FstSlice
*
s
)
{
return
s
->
str
==
NULL
||
s
->
start
<
0
||
s
->
end
<
0
;
return
s
->
str
==
NULL
||
s
->
st
r
->
len
==
0
||
s
->
st
art
<
0
||
s
->
end
<
0
;
}
uint8_t
*
fstSliceData
(
FstSlice
*
s
,
int32_t
*
size
)
{
...
...
@@ -161,7 +161,6 @@ int fstSliceCompare(FstSlice *a, FstSlice *b) {
uint8_t
*
aBuf
=
fstSliceData
(
a
,
&
alen
);
uint8_t
*
bBuf
=
fstSliceData
(
b
,
&
blen
);
uint32_t
i
,
j
;
for
(
i
=
0
,
j
=
0
;
i
<
alen
&&
j
<
blen
;
i
++
,
j
++
)
{
uint8_t
x
=
aBuf
[
i
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录