Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
44e27f29
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
44e27f29
编写于
10月 23, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avoid duplication of name
上级
ada04eb2
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
27 addition
and
27 deletion
+27
-27
source/libs/index/inc/indexFst.h
source/libs/index/inc/indexFst.h
+6
-6
source/libs/index/src/indexFst.c
source/libs/index/src/indexFst.c
+21
-21
未找到文件。
source/libs/index/inc/indexFst.h
浏览文件 @
44e27f29
...
...
@@ -290,21 +290,21 @@ bool fstVerify(Fst* fst);
// refactor this function
bool
fstBuilderNodeCompileTo
(
FstBuilderNode
*
b
,
IdxFstFile
*
wrt
,
CompiledAddr
lastAddr
,
CompiledAddr
startAddr
);
typedef
struct
StreamState
{
typedef
struct
Fst
StreamState
{
FstNode
*
node
;
uint64_t
trans
;
FstOutput
out
;
void
*
autState
;
}
StreamState
;
}
Fst
StreamState
;
void
s
treamStateDestroy
(
void
*
s
);
void
fstS
treamStateDestroy
(
void
*
s
);
typedef
struct
FStmSt
{
Fst
*
fst
;
FAutoCtx
*
aut
;
SArray
*
inp
;
FstOutput
emptyOutput
;
SArray
*
stack
;
// <StreamState>
SArray
*
stack
;
// <
Fst
StreamState>
FstBoundWithData
*
endAt
;
}
FStmSt
;
...
...
@@ -317,14 +317,14 @@ typedef struct FStmStRslt {
FStmStRslt
*
swsResultCreate
(
FstSlice
*
data
,
FstOutput
fOut
,
void
*
state
);
void
swsResultDestroy
(
FStmStRslt
*
result
);
typedef
void
*
(
*
StreamCallback
)(
void
*
);
typedef
void
*
(
*
streamCallback__fn
)(
void
*
);
FStmSt
*
stmStCreate
(
Fst
*
fst
,
FAutoCtx
*
automation
,
FstBoundWithData
*
min
,
FstBoundWithData
*
max
);
void
stmStDestroy
(
FStmSt
*
sws
);
bool
stmStSeekMin
(
FStmSt
*
sws
,
FstBoundWithData
*
min
);
FStmStRslt
*
stmStNextWith
(
FStmSt
*
sws
,
StreamCallback
callback
);
FStmStRslt
*
stmStNextWith
(
FStmSt
*
sws
,
streamCallback__fn
callback
);
FStmBuilder
*
stmBuilderCreate
(
Fst
*
fst
,
FAutoCtx
*
aut
);
...
...
source/libs/index/src/indexFst.c
浏览文件 @
44e27f29
...
...
@@ -1165,7 +1165,7 @@ FStmSt* stmStCreate(Fst* fst, FAutoCtx* automation, FstBoundWithData* min, FstBo
sws
->
emptyOutput
.
null
=
true
;
sws
->
emptyOutput
.
out
=
0
;
sws
->
stack
=
(
SArray
*
)
taosArrayInit
(
256
,
sizeof
(
StreamState
));
sws
->
stack
=
(
SArray
*
)
taosArrayInit
(
256
,
sizeof
(
Fst
StreamState
));
sws
->
endAt
=
max
;
stmStSeekMin
(
sws
,
min
);
...
...
@@ -1177,7 +1177,7 @@ void stmStDestroy(FStmSt* sws) {
}
taosArrayDestroy
(
sws
->
inp
);
taosArrayDestroyEx
(
sws
->
stack
,
s
treamStateDestroy
);
taosArrayDestroyEx
(
sws
->
stack
,
fstS
treamStateDestroy
);
taosMemoryFree
(
sws
);
}
...
...
@@ -1188,7 +1188,7 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
if
(
fstBoundWithDataIsIncluded
(
min
))
{
sws
->
emptyOutput
.
out
=
fstEmptyFinalOutput
(
sws
->
fst
,
&
(
sws
->
emptyOutput
.
null
));
}
StreamState
s
=
{.
node
=
fstGetRoot
(
sws
->
fst
),
Fst
StreamState
s
=
{.
node
=
fstGetRoot
(
sws
->
fst
),
.
trans
=
0
,
.
out
=
{.
null
=
false
,
.
out
=
0
},
.
autState
=
automFuncs
[
aut
->
type
].
start
(
aut
)};
// auto.start callback
...
...
@@ -1223,7 +1223,7 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
autState
=
automFuncs
[
aut
->
type
].
accept
(
aut
,
preState
,
b
);
taosArrayPush
(
sws
->
inp
,
&
b
);
StreamState
s
=
{.
node
=
node
,
.
trans
=
res
+
1
,
.
out
=
{.
null
=
false
,
.
out
=
out
},
.
autState
=
preState
};
Fst
StreamState
s
=
{.
node
=
node
,
.
trans
=
res
+
1
,
.
out
=
{.
null
=
false
,
.
out
=
out
},
.
autState
=
preState
};
node
=
NULL
;
taosArrayPush
(
sws
->
stack
,
&
s
);
...
...
@@ -1244,7 +1244,7 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
}
}
StreamState
s
=
{.
node
=
node
,
.
trans
=
i
,
.
out
=
{.
null
=
false
,
.
out
=
out
},
.
autState
=
autState
};
Fst
StreamState
s
=
{.
node
=
node
,
.
trans
=
i
,
.
out
=
{.
null
=
false
,
.
out
=
out
},
.
autState
=
autState
};
taosArrayPush
(
sws
->
stack
,
&
s
);
taosMemoryFree
(
trans
);
return
true
;
...
...
@@ -1255,7 +1255,7 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
uint32_t
sz
=
taosArrayGetSize
(
sws
->
stack
);
if
(
sz
!=
0
)
{
StreamState
*
s
=
taosArrayGet
(
sws
->
stack
,
sz
-
1
);
Fst
StreamState
*
s
=
taosArrayGet
(
sws
->
stack
,
sz
-
1
);
if
(
inclusize
)
{
s
->
trans
-=
1
;
taosArrayPop
(
sws
->
inp
);
...
...
@@ -1264,7 +1264,7 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
uint64_t
trans
=
s
->
trans
;
FstTransition
trn
;
fstNodeGetTransitionAt
(
n
,
trans
-
1
,
&
trn
);
StreamState
s
=
{
Fst
StreamState
s
=
{
.
node
=
fstGetNode
(
sws
->
fst
,
trn
.
addr
),
.
trans
=
0
,
.
out
=
{.
null
=
false
,
.
out
=
out
},
.
autState
=
autState
};
taosArrayPush
(
sws
->
stack
,
&
s
);
return
true
;
...
...
@@ -1274,14 +1274,14 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
return
false
;
}
FStmStRslt
*
stmStNextWith
(
FStmSt
*
sws
,
StreamCallback
callback
)
{
FStmStRslt
*
stmStNextWith
(
FStmSt
*
sws
,
streamCallback__fn
callback
)
{
FAutoCtx
*
aut
=
sws
->
aut
;
FstOutput
output
=
sws
->
emptyOutput
;
if
(
output
.
null
==
false
)
{
FstSlice
emptySlice
=
fstSliceCreate
(
NULL
,
0
);
if
(
fstBoundWithDataExceededBy
(
sws
->
endAt
,
&
emptySlice
))
{
taosArrayDestroyEx
(
sws
->
stack
,
s
treamStateDestroy
);
sws
->
stack
=
(
SArray
*
)
taosArrayInit
(
256
,
sizeof
(
StreamState
));
taosArrayDestroyEx
(
sws
->
stack
,
fstS
treamStateDestroy
);
sws
->
stack
=
(
SArray
*
)
taosArrayInit
(
256
,
sizeof
(
Fst
StreamState
));
return
NULL
;
}
void
*
start
=
automFuncs
[
aut
->
type
].
start
(
aut
);
...
...
@@ -1292,12 +1292,12 @@ FStmStRslt* stmStNextWith(FStmSt* sws, StreamCallback callback) {
}
SArray
*
nodes
=
taosArrayInit
(
8
,
sizeof
(
FstNode
*
));
while
(
taosArrayGetSize
(
sws
->
stack
)
>
0
)
{
StreamState
*
p
=
(
StreamState
*
)
taosArrayPop
(
sws
->
stack
);
FstStreamState
*
p
=
(
Fst
StreamState
*
)
taosArrayPop
(
sws
->
stack
);
if
(
p
->
trans
>=
FST_NODE_LEN
(
p
->
node
)
||
!
automFuncs
[
aut
->
type
].
canMatch
(
aut
,
p
->
autState
))
{
if
(
FST_NODE_ADDR
(
p
->
node
)
!=
fstGetRootAddr
(
sws
->
fst
))
{
taosArrayPop
(
sws
->
inp
);
}
s
treamStateDestroy
(
p
);
fstS
treamStateDestroy
(
p
);
continue
;
}
FstTransition
trn
;
...
...
@@ -1318,10 +1318,10 @@ FStmStRslt* stmStNextWith(FStmSt* sws, StreamCallback callback) {
isMatch
=
automFuncs
[
aut
->
type
].
isMatch
(
aut
,
eofState
);
}
}
StreamState
s1
=
{.
node
=
p
->
node
,
.
trans
=
p
->
trans
+
1
,
.
out
=
p
->
out
,
.
autState
=
p
->
autState
};
Fst
StreamState
s1
=
{.
node
=
p
->
node
,
.
trans
=
p
->
trans
+
1
,
.
out
=
p
->
out
,
.
autState
=
p
->
autState
};
taosArrayPush
(
sws
->
stack
,
&
s1
);
StreamState
s2
=
{.
node
=
nextNode
,
.
trans
=
0
,
.
out
=
{.
null
=
false
,
.
out
=
out
},
.
autState
=
nextState
};
Fst
StreamState
s2
=
{.
node
=
nextNode
,
.
trans
=
0
,
.
out
=
{.
null
=
false
,
.
out
=
out
},
.
autState
=
nextState
};
taosArrayPush
(
sws
->
stack
,
&
s2
);
int32_t
isz
=
taosArrayGetSize
(
sws
->
inp
);
...
...
@@ -1331,8 +1331,8 @@ FStmStRslt* stmStNextWith(FStmSt* sws, StreamCallback callback) {
}
FstSlice
slice
=
fstSliceCreate
(
buf
,
isz
);
if
(
fstBoundWithDataExceededBy
(
sws
->
endAt
,
&
slice
))
{
taosArrayDestroyEx
(
sws
->
stack
,
s
treamStateDestroy
);
sws
->
stack
=
(
SArray
*
)
taosArrayInit
(
256
,
sizeof
(
StreamState
));
taosArrayDestroyEx
(
sws
->
stack
,
fstS
treamStateDestroy
);
sws
->
stack
=
(
SArray
*
)
taosArrayInit
(
256
,
sizeof
(
Fst
StreamState
));
taosMemoryFreeClear
(
buf
);
fstSliceDestroy
(
&
slice
);
taosArrayDestroy
(
nodes
);
...
...
@@ -1375,11 +1375,11 @@ void swsResultDestroy(FStmStRslt* result) {
taosMemoryFree
(
result
);
}
void
s
treamStateDestroy
(
void
*
s
)
{
void
fstS
treamStateDestroy
(
void
*
s
)
{
if
(
NULL
==
s
)
{
return
;
}
StreamState
*
ss
=
(
StreamState
*
)
s
;
FstStreamState
*
ss
=
(
Fst
StreamState
*
)
s
;
fstNodeDestroy
(
ss
->
node
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录