Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
169f6b3a
T
TDengine
项目概览
taosdata
/
TDengine
11 个月 前同步成功
通知
1179
Star
22014
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,发现更多精彩内容 >>
提交
169f6b3a
编写于
11月 23, 2021
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update fst build struct
上级
0aa47daf
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
166 addition
and
12 deletion
+166
-12
source/libs/index/inc/index_fst.h
source/libs/index/inc/index_fst.h
+41
-9
source/libs/index/inc/index_fst_common.h
source/libs/index/inc/index_fst_common.h
+7
-0
source/libs/index/inc/index_fst_util.h
source/libs/index/inc/index_fst_util.h
+4
-2
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+111
-0
source/libs/index/src/index_fst_common.c
source/libs/index/src/index_fst_common.c
+2
-1
source/libs/index/src/index_fst_util.c
source/libs/index/src/index_fst_util.c
+1
-0
未找到文件。
source/libs/index/inc/index_fst.h
浏览文件 @
169f6b3a
...
...
@@ -99,22 +99,54 @@ FstState fstStateCreateFrom(FstSlice* data, CompiledAddr addr);
FstState
fstStateCreate
(
State
state
);
//compile
void
fstStateCompileForOneTransNext
(
FstState
state
,
FstCountingWriter
*
w
,
CompiledAddr
addr
,
uint8_t
inp
);
void
fstStateCompileForOneTrans
(
FstState
state
,
FstCountingWriter
*
w
,
CompiledAddr
addr
,
FstTransition
trn
);
void
fstStateCompileForAnyTrans
(
FstState
state
,
FstCountingWriter
*
w
,
CompiledAddr
addr
,
FstBuilderNode
*
node
);
void
fstStateCompileForOneTransNext
(
FstState
*
state
,
FstCountingWriter
*
w
,
CompiledAddr
addr
,
uint8_t
inp
);
void
fstStateCompileForOneTrans
(
FstState
*
state
,
FstCountingWriter
*
w
,
CompiledAddr
addr
,
FstTransition
trn
);
void
fstStateCompileForAnyTrans
(
FstState
*
state
,
FstCountingWriter
*
w
,
CompiledAddr
addr
,
FstBuilderNode
*
node
);
// set_comm_input
void
fstStateSetCommInputForOneTransNext
(
FstState
state
,
uint8_t
inp
);
void
fstStateSetCommInputForOneTrans
(
FstState
state
,
uint8_t
inp
);
void
fstStateSetCommInput
(
FstState
*
state
,
uint8_t
inp
);
// comm_input
uint8_t
fstStateCommInputForOneTransNext
(
FstState
state
);
uint8_t
fstStateCommInputForOneTrans
(
FstState
state
);
uint8_t
fstStateCommInput
(
FstState
*
state
);
// input_len
uint64_t
fstStateInputLenForOneTransNext
(
FstState
state
);
uint64_t
fstStateInputLenForOneTrans
(
FstState
state
);
uint64_t
fstStateInputLen
(
FstState
*
state
);
// end_addr
uint64_t
fstStateEndAddrForOneTransNext
(
FstState
*
state
,
FstSlice
*
data
);
uint64_t
fstStateEndAddrForOneTrans
(
FstState
*
state
,
FstSlice
*
data
,
PackSizes
sizes
);
uint64_t
fstStateEndAddrForAnyTrans
(
FstState
*
state
,
uint64_t
version
,
FstSlice
*
date
,
PackSizes
sizes
,
uint64_t
nTrans
);
// input
uint8_t
fstStateInput
(
FstState
*
state
,
FstNode
*
node
);
uint8_t
fstStateInputForAnyTrans
(
FstState
*
state
,
FstNode
*
node
,
uint64_t
i
);
// trans_addr
CompiledAddr
fstStateTransAddr
(
FstState
*
state
,
FstNode
*
node
);
CompiledAddr
fstStateTransAddrForAnyTrans
(
FstState
*
state
,
FstNode
*
node
,
uint64_t
i
);
// sizes
PackSizes
fstStateSizes
(
FstState
*
state
,
FstSlice
*
data
);
// Output
Output
fstStateOutput
(
FstState
*
state
,
FstNode
*
node
);
Output
fstStateOutputForAnyTrans
(
FstState
*
state
,
FstNode
*
node
,
uint64_t
i
);
// anyTrans specify function
void
fstStateSetFinalState
(
FstState
*
state
,
bool
yes
);
bool
fstStateIsFinalState
(
FstState
*
state
);
void
fstStateSetStateNtrans
(
FstState
*
state
,
uint8_t
n
);
// state_ntrans
void
fstStateStateNtrans
(
FstState
*
state
);
uint64_t
fstStateTotalTransSize
(
FstState
*
state
,
uint64_t
version
,
PackSizes
size
,
uint64_t
nTrans
);
uint64_t
fstStateTransIndexSize
(
FstState
*
state
,
uint64_t
version
,
uint64_t
nTrans
);
uint64_t
fstStateNtransLen
(
FstState
*
state
);
uint64_t
fstStateNtrans
(
FstState
*
state
);
Output
fstStateFinalOutput
(
FstState
*
state
,
uint64_t
version
,
FstSlice
*
date
,
PackSizes
sizes
,
uint64_t
nTrans
);
uint64_t
fstStateFindInput
(
FstState
*
state
,
FstNode
*
node
,
uint8_t
b
);
...
...
source/libs/index/inc/index_fst_common.h
0 → 100644
浏览文件 @
169f6b3a
#ifndef __INDEX_FST_COMM_H__
#define __INDEX_FST_COMM_H__
extern
const
uint8_t
COMMON_INPUTS
[];
extern
char
const
COMMON_INPUTS_INV
[];
#endif
source/libs/index/inc/index_fst_util.h
浏览文件 @
169f6b3a
...
...
@@ -18,7 +18,7 @@
#define __INDEX_FST_UTIL_H__
#include "tarray.h"
#include "index_fst_common.h"
typedef
uint64_t
FstType
;
typedef
uint64_t
CompiledAddr
;
...
...
@@ -44,6 +44,8 @@ extern const uint64_t TRANS_INDEX_THRESHOLD;
//
// `0` is a legal value which means there are no transitions/outputs
extern
#define FST_SET_TRANSITION_PACK_SIZE(v, sz) do {v = (v & 0b00001111) | (sz << 4} while(0)
#define FST_GET_TRANSITION_PACK_SIZE(v) (((v) & 0b11110000) >> 4)
#define FST_SET_OUTPUT_PACK_SIZE(v, sz) do { v = (v & 0b11110000) | sz } while(0)
...
...
@@ -79,7 +81,7 @@ FstSlice fstSliceCreate(uint8_t *data, uint64_t dLen);
bool
fstSliceEmpty
(
FstSlice
*
slice
);
int
fstSliceCompare
(
FstSlice
*
a
,
FstSlice
*
b
);
#define FST_SLICE_LEN(s) (
s->end - s
->start + 1)
#define FST_SLICE_LEN(s) (
(s)->end - (s)
->start + 1)
#endif
source/libs/index/src/index_fst.c
浏览文件 @
169f6b3a
...
...
@@ -185,8 +185,119 @@ static FstState stateDict[] = {
FstState
fstStateCreate
(
State
state
){
uint8_t
idx
=
(
uint8_t
)
state
;
return
stateDict
[
idx
];
}
//compile
void
fstStateCompileForOneTransNext
(
FstState
*
state
,
FstCountingWriter
*
w
,
CompiledAddr
addr
,
uint8_t
inp
)
{
return
;
}
void
fstStateCompileForOneTrans
(
FstState
*
state
,
FstCountingWriter
*
w
,
CompiledAddr
addr
,
FstTransition
trn
)
{
return
;
}
void
fstStateCompileForAnyTrans
(
FstState
*
state
,
FstCountingWriter
*
w
,
CompiledAddr
addr
,
FstBuilderNode
*
node
)
{
return
;
}
// set_comm_input
void
fstStateSetCommInput
(
FstState
*
s
,
uint8_t
inp
)
{
assert
(
s
->
state
==
OneTransNext
||
s
->
state
==
OneTrans
);
uint8_t
val
;
COMMON_INDEX
(
inp
,
0x111111
,
val
);
s
->
val
=
(
s
->
val
&
stateDict
[
s
->
state
].
val
)
|
val
;
}
// comm_input
uint8_t
fstStateCommInput
(
FstState
*
s
)
{
assert
(
s
->
state
==
OneTransNext
||
s
->
state
==
OneTrans
);
uint8_t
v
=
s
->
val
&
0
b00111111
;
//v = 0 indicate that common_input is None
return
v
==
0
?
0
:
COMMON_INPUT
(
v
);
}
// input_len
uint64_t
fstStateInputLen
(
FstState
*
s
)
{
assert
(
s
->
state
==
OneTransNext
||
s
->
state
==
OneTrans
);
return
fstStateCommInput
(
s
)
==
0
?
1
:
0
;
}
// end_addr
uint64_t
fstStateEndAddrForOneTransNext
(
FstState
*
s
,
FstSlice
*
data
)
{
return
FST_SLICE_LEN
(
data
)
-
1
-
fstStateInputLen
(
s
);
}
uint64_t
fstStateEndAddrForOneTrans
(
FstState
*
s
,
FstSlice
*
data
,
PackSizes
sizes
)
{
return
FST_SLICE_LEN
(
data
)
-
1
-
fstStateInputLen
(
s
)
-
1
-
FST_GET_TRANSITION_PACK_SIZE
(
sizes
)
-
FST_GET_OUTPUT_PACK_SIZE
(
sizes
);
}
uint64_t
fstStateEndAddrForAnyTrans
(
FstState
*
state
,
uint64_t
version
,
FstSlice
*
date
,
PackSizes
sizes
,
uint64_t
nTrans
)
{
return
1
;
}
// input
uint8_t
fstStateInput
(
FstState
*
state
,
FstNode
*
node
)
{
return
1
;
}
uint8_t
fstStateInputForAnyTrans
(
FstState
*
state
,
FstNode
*
node
,
uint64_t
i
)
{
return
1
;
}
// trans_addr
CompiledAddr
fstStateTransAddr
(
FstState
*
state
,
FstNode
*
node
)
{
return
1
;
}
CompiledAddr
fstStateTransAddrForAnyTrans
(
FstState
*
state
,
FstNode
*
node
,
uint64_t
i
)
{
return
1
;
}
// sizes
PackSizes
fstStateSizes
(
FstState
*
state
,
FstSlice
*
data
)
{
return
1
;
}
// Output
Output
fstStateOutput
(
FstState
*
state
,
FstNode
*
node
)
{
return
1
;
}
Output
fstStateOutputForAnyTrans
(
FstState
*
state
,
FstNode
*
node
,
uint64_t
i
)
{
return
1
;
}
// anyTrans specify function
void
fstStateSetFinalState
(
FstState
*
state
,
bool
yes
)
{
return
;
}
bool
fstStateIsFinalState
(
FstState
*
state
)
{
return
false
;
}
void
fstStateSetStateNtrans
(
FstState
*
state
,
uint8_t
n
)
{
return
;
}
// state_ntrans
void
fstStateStateNtrans
(
FstState
*
state
)
{
return
;
}
uint64_t
fstStateTotalTransSize
(
FstState
*
state
,
uint64_t
version
,
PackSizes
size
,
uint64_t
nTrans
)
{
return
1
;
}
uint64_t
fstStateTransIndexSize
(
FstState
*
state
,
uint64_t
version
,
uint64_t
nTrans
)
{
return
1
;
}
uint64_t
fstStateNtransLen
(
FstState
*
state
)
{
return
1
;
}
uint64_t
fstStateNtrans
(
FstState
*
state
)
{
return
1
;
}
Output
fstStateFinalOutput
(
FstState
*
state
,
uint64_t
version
,
FstSlice
*
date
,
PackSizes
sizes
,
uint64_t
nTrans
)
{
return
1
;
}
uint64_t
fstStateFindInput
(
FstState
*
state
,
FstNode
*
node
,
uint8_t
b
)
{
return
1
;
}
// fst node function
...
...
source/libs/index/src/index_fst_common.c
浏览文件 @
169f6b3a
...
...
@@ -14,6 +14,7 @@
*/
#include "tutil.h"
const
uint8_t
COMMON_INPUTS
[]
=
{
84
,
// '\x00'
85
,
// '\x01'
...
...
@@ -273,7 +274,7 @@ const uint8_t COMMON_INPUTS[] = {
255
,
// 'ÿ'
};
c
har
const
COMMON_INPUTS_INV
[]
=
{
c
onst
char
COMMON_INPUTS_INV
[]
=
{
't'
,
'e'
,
'/'
,
'o'
,
'a'
,
's'
,
'r'
,
'i'
,
'p'
,
'c'
,
'n'
,
'w'
,
'.'
,
'h'
,
'l'
,
'm'
,
'-'
,
'd'
,
'u'
,
'0'
,
'1'
,
'2'
,
'g'
,
'='
,
':'
,
'b'
,
'f'
,
'3'
,
'y'
,
'5'
,
'&'
,
'_'
,
'4'
,
'v'
,
'9'
,
'6'
,
...
...
source/libs/index/src/index_fst_util.c
浏览文件 @
169f6b3a
...
...
@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "index_fst_util.h"
#include "index_fst_common.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录