Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aec7bef2
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
aec7bef2
编写于
3月 03, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add UT
上级
7ae87c10
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
14 deletion
+34
-14
source/libs/index/src/index_tfile.c
source/libs/index/src/index_tfile.c
+3
-0
source/libs/index/test/fstTest.cc
source/libs/index/test/fstTest.cc
+13
-10
source/libs/index/test/jsonUT.cc
source/libs/index/test/jsonUT.cc
+18
-4
未找到文件。
source/libs/index/src/index_tfile.c
浏览文件 @
aec7bef2
...
...
@@ -275,6 +275,7 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
__compar_fn_t
fn
;
int8_t
colType
=
tw
->
header
.
colType
;
colType
=
INDEX_TYPE_GET_TYPE
(
colType
);
if
(
colType
==
TSDB_DATA_TYPE_BINARY
||
colType
==
TSDB_DATA_TYPE_NCHAR
)
{
fn
=
tfileStrCompare
;
}
else
{
...
...
@@ -572,6 +573,8 @@ static int tfileWriteHeader(TFileWriter* writer) {
static
int
tfileWriteData
(
TFileWriter
*
write
,
TFileValue
*
tval
)
{
TFileHeader
*
header
=
&
write
->
header
;
uint8_t
colType
=
header
->
colType
;
colType
=
INDEX_TYPE_GET_TYPE
(
colType
);
if
(
colType
==
TSDB_DATA_TYPE_BINARY
||
colType
==
TSDB_DATA_TYPE_NCHAR
)
{
FstSlice
key
=
fstSliceCreate
((
uint8_t
*
)(
tval
->
colVal
),
(
size_t
)
strlen
(
tval
->
colVal
));
if
(
fstBuilderInsert
(
write
->
fb
,
key
,
tval
->
offset
))
{
...
...
source/libs/index/test/fstTest.cc
浏览文件 @
aec7bef2
...
...
@@ -312,15 +312,18 @@ void validateTFile(char* arg) {
tfCleanup
();
}
void
iterTFileReader
(
char
*
path
,
char
*
ver
)
{
void
iterTFileReader
(
char
*
path
,
char
*
uid
,
char
*
colName
,
char
*
ver
)
{
tfInit
();
int
version
=
atoi
(
ver
);
TFileReader
*
reader
=
tfileReaderOpen
(
path
,
0
,
version
,
"tag1"
);
Iterate
*
iter
=
tfileIteratorCreate
(
reader
);
bool
tn
=
iter
?
iter
->
next
(
iter
)
:
false
;
int
count
=
0
;
int
termCount
=
0
;
uint64_t
suid
=
atoi
(
uid
);
int
version
=
atoi
(
ver
);
TFileReader
*
reader
=
tfileReaderOpen
(
path
,
suid
,
version
,
colName
);
Iterate
*
iter
=
tfileIteratorCreate
(
reader
);
bool
tn
=
iter
?
iter
->
next
(
iter
)
:
false
;
int
count
=
0
;
int
termCount
=
0
;
while
(
tn
==
true
)
{
count
++
;
IterateValue
*
cv
=
iter
->
getValue
(
iter
);
...
...
@@ -337,9 +340,9 @@ void iterTFileReader(char* path, char* ver) {
int
main
(
int
argc
,
char
*
argv
[])
{
// tool to check all kind of fst test
// if (argc > 1) { validateTFile(argv[1]); }
if
(
argc
>
2
)
{
//
opt
iterTFileReader
(
argv
[
1
],
argv
[
2
]);
if
(
argc
>
4
)
{
//
path suid colName ver
iterTFileReader
(
argv
[
1
],
argv
[
2
]
,
argv
[
3
],
argv
[
4
]
);
}
// checkFstCheckIterator();
// checkFstLongTerm();
...
...
source/libs/index/test/jsonUT.cc
浏览文件 @
aec7bef2
...
...
@@ -22,7 +22,7 @@ class JsonEnv : public ::testing::Test {
virtual
void
SetUp
()
{
taosRemoveDir
(
dir
.
c_str
());
taosMkDir
(
dir
.
c_str
());
printf
(
"set up
\n
"
);
opts
=
indexOptsCreate
();
int
ret
=
tIndexJsonOpen
(
opts
,
dir
.
c_str
(),
&
index
);
assert
(
ret
==
0
);
...
...
@@ -30,6 +30,7 @@ class JsonEnv : public ::testing::Test {
virtual
void
TearDown
()
{
tIndexJsonClose
(
index
);
indexOptsDestroy
(
opts
);
printf
(
"destory
\n
"
);
}
SIndexJsonOpts
*
opts
;
SIndexJson
*
index
;
...
...
@@ -37,7 +38,7 @@ class JsonEnv : public ::testing::Test {
TEST_F
(
JsonEnv
,
testWrite
)
{
{
std
::
string
colName
(
"
voltage
"
);
std
::
string
colName
(
"
test
"
);
std
::
string
colVal
(
"ab"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
...
...
@@ -76,7 +77,7 @@ TEST_F(JsonEnv, testWrite) {
indexMultiTermDestroy
(
terms
);
}
{
std
::
string
colName
(
"
voltage
"
);
std
::
string
colName
(
"
test
"
);
std
::
string
colVal
(
"ab"
);
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
...
...
@@ -91,6 +92,19 @@ TEST_F(JsonEnv, testWrite) {
}
}
TEST_F
(
JsonEnv
,
testWriteMillonData
)
{
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"ab"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
for
(
size_t
i
=
0
;
i
<
100
;
i
++
)
{
tIndexJsonPut
(
index
,
terms
,
i
);
}
indexMultiTermDestroy
(
terms
);
}
{
std
::
string
colName
(
"voltagefdadfa"
);
std
::
string
colVal
(
"abxxxxxxxxxxxx"
);
...
...
@@ -105,7 +119,7 @@ TEST_F(JsonEnv, testWriteMillonData) {
indexMultiTermDestroy
(
terms
);
}
{
std
::
string
colName
(
"
voltage
"
);
std
::
string
colName
(
"
test
"
);
std
::
string
colVal
(
"ab"
);
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录