提交 9645f3a0 编写于 作者: P plum-lihui

Merge branch '3.0' of github.com:taosdata/TDengine into 3.0

...@@ -720,6 +720,7 @@ bool fstNodeFindInput(FstNode* node, uint8_t b, uint64_t* res) { ...@@ -720,6 +720,7 @@ bool fstNodeFindInput(FstNode* node, uint8_t b, uint64_t* res) {
uint64_t out = fstStateFindInput(st, node, b, &null); uint64_t out = fstStateFindInput(st, node, b, &null);
if (null == false) { if (null == false) {
*res = out; *res = out;
} else {
s = false; s = false;
} }
} }
...@@ -1238,8 +1239,8 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) { ...@@ -1238,8 +1239,8 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) {
for (uint32_t i = 0; i < len; i++) { for (uint32_t i = 0; i < len; i++) {
uint8_t b = data[i]; uint8_t b = data[i];
uint64_t res = 0; uint64_t res = 0;
bool null = fstNodeFindInput(node, b, &res); bool find = fstNodeFindInput(node, b, &res);
if (null == false) { if (find == true) {
FstTransition trn; FstTransition trn;
fstNodeGetTransitionAt(node, res, &trn); fstNodeGetTransitionAt(node, res, &trn);
void* preState = autState; void* preState = autState;
......
...@@ -101,15 +101,16 @@ class FstReadMemory { ...@@ -101,15 +101,16 @@ class FstReadMemory {
} }
return true; return true;
} }
bool SearchRange(AutomationCtx* ctx, const std::string& low, const std::string& high, std::vector<uint64_t>& result) { bool SearchRange(AutomationCtx* ctx, const std::string& low, RangeType lowType, const std::string& high,
RangeType highType, std::vector<uint64_t>& result) {
FstStreamBuilder* sb = fstSearch(_fst, ctx); FstStreamBuilder* sb = fstSearch(_fst, ctx);
FstSlice l = fstSliceCreate((uint8_t*)low.c_str(), low.size()); FstSlice l = fstSliceCreate((uint8_t*)low.c_str(), low.size());
FstSlice h = fstSliceCreate((uint8_t*)high.c_str(), high.size()); FstSlice h = fstSliceCreate((uint8_t*)high.c_str(), high.size());
// range [low, high); // range [low, high);
fstStreamBuilderSetRange(sb, &l, GE); fstStreamBuilderSetRange(sb, &l, lowType);
fstStreamBuilderSetRange(sb, &h, LT); fstStreamBuilderSetRange(sb, &h, highType);
fstSliceDestroy(&l); fstSliceDestroy(&l);
fstSliceDestroy(&h); fstSliceDestroy(&h);
...@@ -406,11 +407,9 @@ void checkFstCheckIteratorRange1() { ...@@ -406,11 +407,9 @@ void checkFstCheckIteratorRange1() {
{ {
// prefix search // prefix search
std::vector<uint64_t> result; std::vector<uint64_t> result;
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e) // [b, e)
m->SearchRange(ctx, "b", "e", result); m->SearchRange(ctx, "b", GE, "e", LT, result);
assert(result.size() == 3); assert(result.size() == 3);
taosMemoryFree(ctx); taosMemoryFree(ctx);
} }
...@@ -445,7 +444,7 @@ void checkFstCheckIteratorRange2() { ...@@ -445,7 +444,7 @@ void checkFstCheckIteratorRange2() {
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS); AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_ALWAYS);
// [b, e) // [b, e)
m->SearchRange(ctx, "b", "ed", result); m->SearchRange(ctx, "b", GE, "ed", LT, result);
assert(result.size() == 4); assert(result.size() == 4);
taosMemoryFree(ctx); taosMemoryFree(ctx);
} }
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#include "index_fst_util.h" #include "index_fst_util.h"
#include "index_tfile.h" #include "index_tfile.h"
#include "tglobal.h" #include "tglobal.h"
#include "tlog.h"
#include "tskiplist.h" #include "tskiplist.h"
#include "tutil.h" #include "tutil.h"
#include "tlog.h"
static std::string dir = "/tmp/index"; static std::string dir = "/tmp/index";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册