Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c7ed1de0
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
未验证
提交
c7ed1de0
编写于
3月 29, 2022
作者:
dengyihao
提交者:
GitHub
3月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11085 from taosdata/feature/index_query
handle except
上级
e138090e
9a445b26
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
29 addition
and
26 deletion
+29
-26
.clang-format
.clang-format
+0
-1
example/src/tstream.c
example/src/tstream.c
+2
-2
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+4
-7
source/libs/index/test/fstTest.cc
source/libs/index/test/fstTest.cc
+23
-16
未找到文件。
.clang-format
浏览文件 @
c7ed1de0
...
@@ -5,7 +5,6 @@ AccessModifierOffset: -1
...
@@ -5,7 +5,6 @@ AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlinesLeft: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignOperands: true
AlignTrailingComments: true
AlignTrailingComments: true
...
...
example/src/tstream.c
浏览文件 @
c7ed1de0
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#include "taos.h"
#include "taos.h"
int32_t
init_env
()
{
int32_t
init_env
()
{
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
701
0
);
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -65,7 +65,7 @@ int32_t init_env() {
...
@@ -65,7 +65,7 @@ int32_t init_env() {
int32_t
create_stream
()
{
int32_t
create_stream
()
{
printf
(
"create stream
\n
"
);
printf
(
"create stream
\n
"
);
TAOS_RES
*
pRes
;
TAOS_RES
*
pRes
;
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
701
0
);
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
...
...
source/libs/index/src/index_fst.c
浏览文件 @
c7ed1de0
...
@@ -1293,7 +1293,6 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) {
...
@@ -1293,7 +1293,6 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) {
return
false
;
return
false
;
}
}
StreamWithStateResult
*
streamWithStateNextWith
(
StreamWithState
*
sws
,
StreamCallback
callback
)
{
StreamWithStateResult
*
streamWithStateNextWith
(
StreamWithState
*
sws
,
StreamCallback
callback
)
{
AutomationCtx
*
aut
=
sws
->
aut
;
AutomationCtx
*
aut
=
sws
->
aut
;
FstOutput
output
=
sws
->
emptyOutput
;
FstOutput
output
=
sws
->
emptyOutput
;
...
@@ -1317,7 +1316,7 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
...
@@ -1317,7 +1316,7 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
if
(
FST_NODE_ADDR
(
p
->
node
)
!=
fstGetRootAddr
(
sws
->
fst
))
{
if
(
FST_NODE_ADDR
(
p
->
node
)
!=
fstGetRootAddr
(
sws
->
fst
))
{
taosArrayPop
(
sws
->
inp
);
taosArrayPop
(
sws
->
inp
);
}
}
//
streamStateDestroy(p);
streamStateDestroy
(
p
);
continue
;
continue
;
}
}
FstTransition
trn
;
FstTransition
trn
;
...
@@ -1356,6 +1355,7 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
...
@@ -1356,6 +1355,7 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
sws
->
stack
=
(
SArray
*
)
taosArrayInit
(
256
,
sizeof
(
StreamState
));
sws
->
stack
=
(
SArray
*
)
taosArrayInit
(
256
,
sizeof
(
StreamState
));
taosMemoryFreeClear
(
buf
);
taosMemoryFreeClear
(
buf
);
fstSliceDestroy
(
&
slice
);
fstSliceDestroy
(
&
slice
);
taosArrayDestroy
(
nodes
);
return
NULL
;
return
NULL
;
}
}
if
(
FST_NODE_IS_FINAL
(
nextNode
)
&&
isMatch
)
{
if
(
FST_NODE_IS_FINAL
(
nextNode
)
&&
isMatch
)
{
...
@@ -1364,15 +1364,12 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
...
@@ -1364,15 +1364,12 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
taosMemoryFreeClear
(
buf
);
taosMemoryFreeClear
(
buf
);
fstSliceDestroy
(
&
slice
);
fstSliceDestroy
(
&
slice
);
taosArrayDestroy
(
nodes
);
taosArrayDestroy
(
nodes
);
nodes
=
NULL
;
return
result
;
return
result
;
}
}
taosMemoryFreeClear
(
buf
);
taosMemoryFreeClear
(
buf
);
fstSliceDestroy
(
&
slice
);
fstSliceDestroy
(
&
slice
);
}
};
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
nodes
);
i
++
)
{
FstNode
**
node
=
(
FstNode
**
)
taosArrayGet
(
nodes
,
i
);
fstNodeDestroy
(
*
node
);
}
taosArrayDestroy
(
nodes
);
taosArrayDestroy
(
nodes
);
return
NULL
;
return
NULL
;
}
}
...
...
source/libs/index/test/fstTest.cc
浏览文件 @
c7ed1de0
...
@@ -99,6 +99,8 @@ class FstReadMemory {
...
@@ -99,6 +99,8 @@ class FstReadMemory {
result
.
push_back
(
rt
->
out
.
out
);
result
.
push_back
(
rt
->
out
.
out
);
swsResultDestroy
(
rt
);
swsResultDestroy
(
rt
);
}
}
streamWithStateDestroy
(
st
);
fstStreamBuilderDestroy
(
sb
);
return
true
;
return
true
;
}
}
bool
SearchRange
(
AutomationCtx
*
ctx
,
const
std
::
string
&
low
,
RangeType
lowType
,
const
std
::
string
&
high
,
bool
SearchRange
(
AutomationCtx
*
ctx
,
const
std
::
string
&
low
,
RangeType
lowType
,
const
std
::
string
&
high
,
...
@@ -127,6 +129,8 @@ class FstReadMemory {
...
@@ -127,6 +129,8 @@ class FstReadMemory {
result
.
push_back
(
rt
->
out
.
out
);
result
.
push_back
(
rt
->
out
.
out
);
swsResultDestroy
(
rt
);
swsResultDestroy
(
rt
);
}
}
streamWithStateDestroy
(
st
);
fstStreamBuilderDestroy
(
sb
);
return
true
;
return
true
;
}
}
bool
SearchWithTimeCostUs
(
AutomationCtx
*
ctx
,
std
::
vector
<
uint64_t
>&
result
)
{
bool
SearchWithTimeCostUs
(
AutomationCtx
*
ctx
,
std
::
vector
<
uint64_t
>&
result
)
{
...
@@ -290,8 +294,8 @@ void checkFstCheckIterator1() {
...
@@ -290,8 +294,8 @@ void checkFstCheckIterator1() {
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++
)
{
// assert(result[i] == i); // check result
// assert(result[i] == i); // check result
}
}
automCtxDestroy
(
ctx
);
taosMemoryFree
(
ctx
);
delete
m
;
delete
m
;
}
}
void
checkFstCheckIterator2
()
{
void
checkFstCheckIterator2
()
{
...
@@ -325,8 +329,8 @@ void checkFstCheckIterator2() {
...
@@ -325,8 +329,8 @@ void checkFstCheckIterator2() {
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++
)
{
// assert(result[i] == i); // check result
// assert(result[i] == i); // check result
}
}
automCtxDestroy
(
ctx
);
taosMemoryFree
(
ctx
);
delete
m
;
delete
m
;
}
}
void
checkFstCheckIteratorPrefix
()
{
void
checkFstCheckIteratorPrefix
()
{
...
@@ -361,7 +365,7 @@ void checkFstCheckIteratorPrefix() {
...
@@ -361,7 +365,7 @@ void checkFstCheckIteratorPrefix() {
AutomationCtx
*
ctx
=
automCtxCreate
((
void
*
)
"he"
,
AUTOMATION_PREFIX
);
AutomationCtx
*
ctx
=
automCtxCreate
((
void
*
)
"he"
,
AUTOMATION_PREFIX
);
m
->
Search
(
ctx
,
result
);
m
->
Search
(
ctx
,
result
);
assert
(
result
.
size
()
==
1
);
assert
(
result
.
size
()
==
1
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
{
{
// prefix search
// prefix search
...
@@ -370,7 +374,7 @@ void checkFstCheckIteratorPrefix() {
...
@@ -370,7 +374,7 @@ void checkFstCheckIteratorPrefix() {
AutomationCtx
*
ctx
=
automCtxCreate
((
void
*
)
"Hello"
,
AUTOMATION_PREFIX
);
AutomationCtx
*
ctx
=
automCtxCreate
((
void
*
)
"Hello"
,
AUTOMATION_PREFIX
);
m
->
Search
(
ctx
,
result
);
m
->
Search
(
ctx
,
result
);
assert
(
result
.
size
()
==
2
);
assert
(
result
.
size
()
==
2
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
{
{
std
::
vector
<
uint64_t
>
result
;
std
::
vector
<
uint64_t
>
result
;
...
@@ -378,7 +382,7 @@ void checkFstCheckIteratorPrefix() {
...
@@ -378,7 +382,7 @@ void checkFstCheckIteratorPrefix() {
AutomationCtx
*
ctx
=
automCtxCreate
((
void
*
)
"jddd"
,
AUTOMATION_PREFIX
);
AutomationCtx
*
ctx
=
automCtxCreate
((
void
*
)
"jddd"
,
AUTOMATION_PREFIX
);
m
->
Search
(
ctx
,
result
);
m
->
Search
(
ctx
,
result
);
assert
(
result
.
size
()
==
1
);
assert
(
result
.
size
()
==
1
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
delete
m
;
delete
m
;
}
}
...
@@ -413,7 +417,7 @@ void checkFstCheckIteratorRange1() {
...
@@ -413,7 +417,7 @@ void checkFstCheckIteratorRange1() {
// [b, e)
// [b, e)
m
->
SearchRange
(
ctx
,
"b"
,
GE
,
"e"
,
LT
,
result
);
m
->
SearchRange
(
ctx
,
"b"
,
GE
,
"e"
,
LT
,
result
);
assert
(
result
.
size
()
==
3
);
assert
(
result
.
size
()
==
3
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
{
{
// prefix search
// prefix search
...
@@ -422,7 +426,7 @@ void checkFstCheckIteratorRange1() {
...
@@ -422,7 +426,7 @@ void checkFstCheckIteratorRange1() {
// [b, e)
// [b, e)
m
->
SearchRange
(
ctx
,
"b"
,
GT
,
"e"
,
LT
,
result
);
m
->
SearchRange
(
ctx
,
"b"
,
GT
,
"e"
,
LT
,
result
);
assert
(
result
.
size
()
==
2
);
assert
(
result
.
size
()
==
2
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
{
{
// prefix search
// prefix search
...
@@ -431,7 +435,7 @@ void checkFstCheckIteratorRange1() {
...
@@ -431,7 +435,7 @@ void checkFstCheckIteratorRange1() {
// [b, e)
// [b, e)
m
->
SearchRange
(
ctx
,
"b"
,
GT
,
"e"
,
LE
,
result
);
m
->
SearchRange
(
ctx
,
"b"
,
GT
,
"e"
,
LE
,
result
);
assert
(
result
.
size
()
==
3
);
assert
(
result
.
size
()
==
3
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
{
{
// prefix search
// prefix search
...
@@ -440,8 +444,9 @@ void checkFstCheckIteratorRange1() {
...
@@ -440,8 +444,9 @@ void checkFstCheckIteratorRange1() {
// [b, e)
// [b, e)
m
->
SearchRange
(
ctx
,
"b"
,
GE
,
"e"
,
LE
,
result
);
m
->
SearchRange
(
ctx
,
"b"
,
GE
,
"e"
,
LE
,
result
);
assert
(
result
.
size
()
==
4
);
assert
(
result
.
size
()
==
4
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
delete
m
;
}
}
void
checkFstCheckIteratorRange2
()
{
void
checkFstCheckIteratorRange2
()
{
FstWriter
*
fw
=
new
FstWriter
;
FstWriter
*
fw
=
new
FstWriter
;
...
@@ -473,7 +478,7 @@ void checkFstCheckIteratorRange2() {
...
@@ -473,7 +478,7 @@ void checkFstCheckIteratorRange2() {
// [b, e)
// [b, e)
m
->
SearchRange
(
ctx
,
"b"
,
GE
,
"ed"
,
LT
,
result
);
m
->
SearchRange
(
ctx
,
"b"
,
GE
,
"ed"
,
LT
,
result
);
assert
(
result
.
size
()
==
4
);
assert
(
result
.
size
()
==
4
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
{
{
// range search
// range search
...
@@ -482,7 +487,8 @@ void checkFstCheckIteratorRange2() {
...
@@ -482,7 +487,8 @@ void checkFstCheckIteratorRange2() {
// [b, e)
// [b, e)
m
->
SearchRange
(
ctx
,
"b"
,
GE
,
"ed"
,
LE
,
result
);
m
->
SearchRange
(
ctx
,
"b"
,
GE
,
"ed"
,
LE
,
result
);
assert
(
result
.
size
()
==
5
);
assert
(
result
.
size
()
==
5
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
// taosMemoryFree(ctx);
}
}
{
{
// range search
// range search
...
@@ -491,7 +497,7 @@ void checkFstCheckIteratorRange2() {
...
@@ -491,7 +497,7 @@ void checkFstCheckIteratorRange2() {
// [b, e)
// [b, e)
m
->
SearchRange
(
ctx
,
"b"
,
GT
,
"ed"
,
LE
,
result
);
m
->
SearchRange
(
ctx
,
"b"
,
GT
,
"ed"
,
LE
,
result
);
assert
(
result
.
size
()
==
4
);
assert
(
result
.
size
()
==
4
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
{
{
// range search
// range search
...
@@ -500,8 +506,9 @@ void checkFstCheckIteratorRange2() {
...
@@ -500,8 +506,9 @@ void checkFstCheckIteratorRange2() {
// [b, e)
// [b, e)
m
->
SearchRange
(
ctx
,
"b"
,
GT
,
"ed"
,
LT
,
result
);
m
->
SearchRange
(
ctx
,
"b"
,
GT
,
"ed"
,
LT
,
result
);
assert
(
result
.
size
()
==
3
);
assert
(
result
.
size
()
==
3
);
taosMemoryFree
(
ctx
);
automCtxDestroy
(
ctx
);
}
}
delete
m
;
}
}
void
fst_get
(
Fst
*
fst
)
{
void
fst_get
(
Fst
*
fst
)
{
...
@@ -566,9 +573,9 @@ int main(int argc, char* argv[]) {
...
@@ -566,9 +573,9 @@ int main(int argc, char* argv[]) {
// path suid colName ver
// path suid colName ver
// iterTFileReader(argv[1], argv[2], argv[3], argv[4]);
// iterTFileReader(argv[1], argv[2], argv[3], argv[4]);
//}
//}
//
checkFstCheckIterator1();
checkFstCheckIterator1
();
//
checkFstCheckIterator2();
checkFstCheckIterator2
();
//
checkFstCheckIteratorPrefix();
checkFstCheckIteratorPrefix
();
checkFstCheckIteratorRange1
();
checkFstCheckIteratorRange1
();
checkFstCheckIteratorRange2
();
checkFstCheckIteratorRange2
();
// checkFstLongTerm();
// checkFstLongTerm();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录