Merge pull request #9045 from taosdata/feature/fst

update fst search frame
This commit is contained in:
Yihao Deng 2021-12-11 16:52:15 +08:00 committed by GitHub
commit f45083c6aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 4 deletions

View File

@ -275,6 +275,7 @@ FstNode* fstGetRoot(Fst *fst);
FstType fstGetType(Fst *fst); FstType fstGetType(Fst *fst);
CompiledAddr fstGetRootAddr(Fst *fst); CompiledAddr fstGetRootAddr(Fst *fst);
Output fstEmptyFinalOutput(Fst *fst, bool *null); Output fstEmptyFinalOutput(Fst *fst, bool *null);
bool fstVerify(Fst *fst); bool fstVerify(Fst *fst);

View File

@ -50,6 +50,7 @@ typedef struct AutomationFunc {
} AutomationFunc; } AutomationFunc;
AutomationCtx *automCtxCreate(void *data, AutomationType type); AutomationCtx *automCtxCreate(void *data, AutomationType type);
void autoCtxDestroy(AutomationCtx *ctx);
extern AutomationFunc automFuncs[]; extern AutomationFunc automFuncs[];
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1072,7 +1072,6 @@ bool fstGet(Fst *fst, FstSlice *b, Output *out) {
tOut += trn.out; tOut += trn.out;
root = fstGetNode(fst, trn.addr); root = fstGetNode(fst, trn.addr);
taosArrayPush(nodes, &root); taosArrayPush(nodes, &root);
//fstNodeDestroy(root);
} }
if (!FST_NODE_IS_FINAL(root)) { if (!FST_NODE_IS_FINAL(root)) {
return false; return false;

View File

@ -75,15 +75,23 @@ AutomationFunc automFuncs[] = {{
patternAccept, patternAccept,
patternAcceptEof patternAcceptEof
} }
// add more search type
}; };
AutomationCtx* automCtxCreate(void *data, AutomationType type) { AutomationCtx* automCtxCreate(void *data, AutomationType type) {
AutomationCtx *ctx = calloc(1, sizeof(AutomationCtx)); AutomationCtx *ctx = calloc(1, sizeof(AutomationCtx));
if (ctx == NULL) { return NULL; } if (ctx == NULL) { return NULL; }
ctx->type = type; ctx->type = type;
if (type == AUTOMATION_PREFIX) { if (ctx->type == AUTOMATION_PREFIX) {
} else if (ctx->type == AUTMMATION_MATCH) {
} else {
// add more search type
} }
return ctx;
}
void autoCtxDestroy(AutomationCtx *ctx) {
free(ctx);
} }