Merge pull request #11085 from taosdata/feature/index_query
handle except
This commit is contained in:
commit
c7ed1de0d6
|
@ -5,7 +5,6 @@ AccessModifierOffset: -1
|
|||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignConsecutiveMacros: true
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "taos.h"
|
||||
|
||||
int32_t init_env() {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 7010);
|
||||
if (pConn == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ int32_t init_env() {
|
|||
int32_t create_stream() {
|
||||
printf("create stream\n");
|
||||
TAOS_RES* pRes;
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 7010);
|
||||
if (pConn == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1293,7 +1293,6 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallback callback) {
|
||||
AutomationCtx* aut = sws->aut;
|
||||
FstOutput output = sws->emptyOutput;
|
||||
|
@ -1317,7 +1316,7 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
|
|||
if (FST_NODE_ADDR(p->node) != fstGetRootAddr(sws->fst)) {
|
||||
taosArrayPop(sws->inp);
|
||||
}
|
||||
// streamStateDestroy(p);
|
||||
streamStateDestroy(p);
|
||||
continue;
|
||||
}
|
||||
FstTransition trn;
|
||||
|
@ -1356,6 +1355,7 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
|
|||
sws->stack = (SArray*)taosArrayInit(256, sizeof(StreamState));
|
||||
taosMemoryFreeClear(buf);
|
||||
fstSliceDestroy(&slice);
|
||||
taosArrayDestroy(nodes);
|
||||
return NULL;
|
||||
}
|
||||
if (FST_NODE_IS_FINAL(nextNode) && isMatch) {
|
||||
|
@ -1364,15 +1364,12 @@ StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallb
|
|||
taosMemoryFreeClear(buf);
|
||||
fstSliceDestroy(&slice);
|
||||
taosArrayDestroy(nodes);
|
||||
nodes = NULL;
|
||||
return result;
|
||||
}
|
||||
taosMemoryFreeClear(buf);
|
||||
fstSliceDestroy(&slice);
|
||||
}
|
||||
for (size_t i = 0; i < taosArrayGetSize(nodes); i++) {
|
||||
FstNode** node = (FstNode**)taosArrayGet(nodes, i);
|
||||
fstNodeDestroy(*node);
|
||||
}
|
||||
};
|
||||
taosArrayDestroy(nodes);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,8 @@ class FstReadMemory {
|
|||
result.push_back(rt->out.out);
|
||||
swsResultDestroy(rt);
|
||||
}
|
||||
streamWithStateDestroy(st);
|
||||
fstStreamBuilderDestroy(sb);
|
||||
return true;
|
||||
}
|
||||
bool SearchRange(AutomationCtx* ctx, const std::string& low, RangeType lowType, const std::string& high,
|
||||
|
@ -127,6 +129,8 @@ class FstReadMemory {
|
|||
result.push_back(rt->out.out);
|
||||
swsResultDestroy(rt);
|
||||
}
|
||||
streamWithStateDestroy(st);
|
||||
fstStreamBuilderDestroy(sb);
|
||||
return true;
|
||||
}
|
||||
bool SearchWithTimeCostUs(AutomationCtx* ctx, std::vector<uint64_t>& result) {
|
||||
|
@ -290,8 +294,8 @@ void checkFstCheckIterator1() {
|
|||
for (int i = 0; i < result.size(); i++) {
|
||||
// assert(result[i] == i); // check result
|
||||
}
|
||||
automCtxDestroy(ctx);
|
||||
|
||||
taosMemoryFree(ctx);
|
||||
delete m;
|
||||
}
|
||||
void checkFstCheckIterator2() {
|
||||
|
@ -325,8 +329,8 @@ void checkFstCheckIterator2() {
|
|||
for (int i = 0; i < result.size(); i++) {
|
||||
// assert(result[i] == i); // check result
|
||||
}
|
||||
automCtxDestroy(ctx);
|
||||
|
||||
taosMemoryFree(ctx);
|
||||
delete m;
|
||||
}
|
||||
void checkFstCheckIteratorPrefix() {
|
||||
|
@ -361,7 +365,7 @@ void checkFstCheckIteratorPrefix() {
|
|||
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_PREFIX);
|
||||
m->Search(ctx, result);
|
||||
assert(result.size() == 1);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
{
|
||||
// prefix search
|
||||
|
@ -370,7 +374,7 @@ void checkFstCheckIteratorPrefix() {
|
|||
AutomationCtx* ctx = automCtxCreate((void*)"Hello", AUTOMATION_PREFIX);
|
||||
m->Search(ctx, result);
|
||||
assert(result.size() == 2);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
{
|
||||
std::vector<uint64_t> result;
|
||||
|
@ -378,7 +382,7 @@ void checkFstCheckIteratorPrefix() {
|
|||
AutomationCtx* ctx = automCtxCreate((void*)"jddd", AUTOMATION_PREFIX);
|
||||
m->Search(ctx, result);
|
||||
assert(result.size() == 1);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
delete m;
|
||||
}
|
||||
|
@ -413,7 +417,7 @@ void checkFstCheckIteratorRange1() {
|
|||
// [b, e)
|
||||
m->SearchRange(ctx, "b", GE, "e", LT, result);
|
||||
assert(result.size() == 3);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
{
|
||||
// prefix search
|
||||
|
@ -422,7 +426,7 @@ void checkFstCheckIteratorRange1() {
|
|||
// [b, e)
|
||||
m->SearchRange(ctx, "b", GT, "e", LT, result);
|
||||
assert(result.size() == 2);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
{
|
||||
// prefix search
|
||||
|
@ -431,7 +435,7 @@ void checkFstCheckIteratorRange1() {
|
|||
// [b, e)
|
||||
m->SearchRange(ctx, "b", GT, "e", LE, result);
|
||||
assert(result.size() == 3);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
{
|
||||
// prefix search
|
||||
|
@ -440,8 +444,9 @@ void checkFstCheckIteratorRange1() {
|
|||
// [b, e)
|
||||
m->SearchRange(ctx, "b", GE, "e", LE, result);
|
||||
assert(result.size() == 4);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
delete m;
|
||||
}
|
||||
void checkFstCheckIteratorRange2() {
|
||||
FstWriter* fw = new FstWriter;
|
||||
|
@ -473,7 +478,7 @@ void checkFstCheckIteratorRange2() {
|
|||
// [b, e)
|
||||
m->SearchRange(ctx, "b", GE, "ed", LT, result);
|
||||
assert(result.size() == 4);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
{
|
||||
// range search
|
||||
|
@ -482,7 +487,8 @@ void checkFstCheckIteratorRange2() {
|
|||
// [b, e)
|
||||
m->SearchRange(ctx, "b", GE, "ed", LE, result);
|
||||
assert(result.size() == 5);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
// taosMemoryFree(ctx);
|
||||
}
|
||||
{
|
||||
// range search
|
||||
|
@ -491,7 +497,7 @@ void checkFstCheckIteratorRange2() {
|
|||
// [b, e)
|
||||
m->SearchRange(ctx, "b", GT, "ed", LE, result);
|
||||
assert(result.size() == 4);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
{
|
||||
// range search
|
||||
|
@ -500,8 +506,9 @@ void checkFstCheckIteratorRange2() {
|
|||
// [b, e)
|
||||
m->SearchRange(ctx, "b", GT, "ed", LT, result);
|
||||
assert(result.size() == 3);
|
||||
taosMemoryFree(ctx);
|
||||
automCtxDestroy(ctx);
|
||||
}
|
||||
delete m;
|
||||
}
|
||||
|
||||
void fst_get(Fst* fst) {
|
||||
|
@ -566,9 +573,9 @@ int main(int argc, char* argv[]) {
|
|||
// path suid colName ver
|
||||
// iterTFileReader(argv[1], argv[2], argv[3], argv[4]);
|
||||
//}
|
||||
// checkFstCheckIterator1();
|
||||
// checkFstCheckIterator2();
|
||||
// checkFstCheckIteratorPrefix();
|
||||
checkFstCheckIterator1();
|
||||
checkFstCheckIterator2();
|
||||
checkFstCheckIteratorPrefix();
|
||||
checkFstCheckIteratorRange1();
|
||||
checkFstCheckIteratorRange2();
|
||||
// checkFstLongTerm();
|
||||
|
|
Loading…
Reference in New Issue