Merge branch '3.0' into feature/vnode
This commit is contained in:
commit
e5920022ab
|
@ -167,7 +167,10 @@ uint64_t fstUnFinishedNodesFindCommPrefixAndSetOutput(FstUnFinishedNodes *node,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (addPrefix != 0) {
|
if (addPrefix != 0) {
|
||||||
fstBuilderNodeUnfinishedAddOutputPrefix(un, addPrefix);
|
if (i + 1 < ssz) {
|
||||||
|
FstBuilderNodeUnfinished *unf = taosArrayGet(node->stack, i + 1);
|
||||||
|
fstBuilderNodeUnfinishedAddOutputPrefix(unf, addPrefix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
|
@ -581,14 +584,13 @@ uint64_t fstStateFindInput(FstState *s, FstNode *node, uint8_t b, bool *null) {
|
||||||
- 1 // pack size
|
- 1 // pack size
|
||||||
- node->nTrans;
|
- node->nTrans;
|
||||||
uint64_t end = start + node->nTrans;
|
uint64_t end = start + node->nTrans;
|
||||||
uint64_t len = end - start;
|
FstSlice t = fstSliceCopy(slice, start, end - 1);
|
||||||
int32_t dlen = 0;
|
int32_t len = 0;
|
||||||
uint8_t *data = fstSliceData(slice, &dlen);
|
uint8_t *data = fstSliceData(&t, &len);
|
||||||
for(int i = 0; i < len; i++) {
|
for(int i = 0; i < len; i++) {
|
||||||
//uint8_t v = slice->data[slice->start + i];
|
//uint8_t v = slice->data[slice->start + i];
|
||||||
////slice->data[slice->start + i];
|
////slice->data[slice->start + i];
|
||||||
uint8_t v = data[i];
|
uint8_t v = data[i];
|
||||||
|
|
||||||
if (v == b) {
|
if (v == b) {
|
||||||
return node->nTrans - i - 1; // bug
|
return node->nTrans - i - 1; // bug
|
||||||
}
|
}
|
||||||
|
@ -1060,7 +1062,7 @@ bool fstGet(Fst *fst, FstSlice *b, Output *out) {
|
||||||
}
|
}
|
||||||
*out = tOut;
|
*out = tOut;
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FstNode *fstGetRoot(Fst *fst) {
|
FstNode *fstGetRoot(Fst *fst) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ int main(int argc, char** argv) {
|
||||||
std::string str("aaa");
|
std::string str("aaa");
|
||||||
str[2] = 'a' + i ;
|
str[2] = 'a' + i ;
|
||||||
FstSlice key = fstSliceCreate((uint8_t *)str.c_str(), str.size());
|
FstSlice key = fstSliceCreate((uint8_t *)str.c_str(), str.size());
|
||||||
Output val = 2;
|
Output val = 0;
|
||||||
fstBuilderInsert(b, key, val);
|
fstBuilderInsert(b, key, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,13 +108,14 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
Fst *fst = fstCreate(&s);
|
Fst *fst = fstCreate(&s);
|
||||||
{
|
{
|
||||||
std::string str("aaa");
|
std::string str("aax");
|
||||||
uint64_t out;
|
uint64_t out;
|
||||||
|
|
||||||
|
|
||||||
FstSlice key = fstSliceCreate((uint8_t *)str.c_str(), str.size());
|
FstSlice key = fstSliceCreate((uint8_t *)str.c_str(), str.size());
|
||||||
bool ok = fstGet(fst, &key, &out);
|
bool ok = fstGet(fst, &key, &out);
|
||||||
if (ok == true) {
|
if (ok == true) {
|
||||||
|
printf("val = %d\n", out);
|
||||||
//indexInfo("Get key-value success, %s, %d", str.c_str(), out);
|
//indexInfo("Get key-value success, %s, %d", str.c_str(), out);
|
||||||
} else {
|
} else {
|
||||||
//indexError("Get key-value failed, %s", str.c_str());
|
//indexError("Get key-value failed, %s", str.c_str());
|
||||||
|
|
Loading…
Reference in New Issue