Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c3760f27
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
c3760f27
编写于
5月 14, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(index): fix tag query error
上级
70171a66
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
66 addition
and
39 deletion
+66
-39
source/libs/index/src/index.c
source/libs/index/src/index.c
+1
-3
source/libs/index/src/indexCache.c
source/libs/index/src/indexCache.c
+0
-1
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+27
-1
source/libs/index/test/jsonUT.cc
source/libs/index/test/jsonUT.cc
+38
-34
未找到文件。
source/libs/index/src/index.c
浏览文件 @
c3760f27
...
...
@@ -109,17 +109,15 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
taosThreadMutexInit
(
&
sIdx
->
mtx
,
NULL
);
sIdx
->
refId
=
indexAddRef
(
sIdx
);
taosAcquireRef
(
indexRefMgt
,
sIdx
->
refId
);
indexAcquireRef
(
sIdx
->
refId
);
*
index
=
sIdx
;
return
0
;
END:
if
(
sIdx
!=
NULL
)
{
indexClose
(
sIdx
);
}
*
index
=
NULL
;
return
-
1
;
}
...
...
source/libs/index/src/indexCache.c
浏览文件 @
c3760f27
...
...
@@ -463,7 +463,6 @@ int indexCacheSchedToMerge(IndexCache* pCache) {
// schedMsg.thandle = taosMemoryCalloc(1, sizeof(int64_t));
// memcpy((char*)(schedMsg.thandle), (char*)&(pCache->index->refId), sizeof(int64_t));
schedMsg
.
msg
=
NULL
;
indexAcquireRef
(
pCache
->
index
->
refId
);
taosScheduleTask
(
indexQhandle
,
&
schedMsg
);
...
...
source/libs/index/src/indexComm.c
浏览文件 @
c3760f27
...
...
@@ -39,10 +39,36 @@ static TExeCond tCompareLessEqual(void* a, void* b, int8_t type) {
}
static
TExeCond
tCompareGreaterThan
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
indexGetCompar
(
type
);
if
(
type
==
TSDB_DATA_TYPE_INT
)
{
char
*
v1
=
(
char
*
)
a
;
char
*
v2
=
(
char
*
)
b
;
for
(
int
i
=
0
;
i
<
sizeof
(
int32_t
);
i
++
)
{
if
(
v1
[
i
]
==
'0'
)
{
v1
[
i
]
=
0
;
}
if
(
v2
[
i
]
==
'0'
)
{
v2
[
i
]
=
0
;
}
}
return
tDoCommpare
(
func
,
QUERY_GREATER_THAN
,
v1
,
v2
);
}
return
tDoCommpare
(
func
,
QUERY_GREATER_THAN
,
a
,
b
);
}
static
TExeCond
tCompareGreaterEqual
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
indexGetCompar
(
type
);
if
(
type
==
TSDB_DATA_TYPE_INT
)
{
char
*
v1
=
(
char
*
)
a
;
char
*
v2
=
(
char
*
)
b
;
for
(
int
i
=
0
;
i
<
sizeof
(
int32_t
);
i
++
)
{
if
(
v1
[
i
]
==
'0'
)
{
v1
[
i
]
=
0
;
}
if
(
v2
[
i
]
==
'0'
)
{
v2
[
i
]
=
0
;
}
}
return
tDoCommpare
(
func
,
QUERY_GREATER_EQUAL
,
v1
,
v2
);
}
return
tDoCommpare
(
func
,
QUERY_GREATER_EQUAL
,
a
,
b
);
}
...
...
@@ -216,7 +242,7 @@ int32_t indexConvertData(void* src, int8_t type, void** dst) {
}
*
dst
=
*
dst
-
tlen
;
if
(
type
!=
TSDB_DATA_TYPE_BINARY
&&
type
!=
TSDB_DATA_TYPE_NCHAR
&&
type
!=
TSDB_DATA_TYPE_VARBINARY
&&
type
=
=
TSDB_DATA_TYPE_VARCHAR
)
{
type
!
=
TSDB_DATA_TYPE_VARCHAR
)
{
uint8_t
*
p
=
*
dst
;
for
(
int
i
=
0
;
i
<
tlen
;
i
++
)
{
if
(
p
[
i
]
==
0
)
{
...
...
source/libs/index/test/jsonUT.cc
浏览文件 @
c3760f27
...
...
@@ -204,9 +204,10 @@ TEST_F(JsonEnv, testWriteMillonData) {
TEST_F
(
JsonEnv
,
testWriteJsonNumberData
)
{
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"10"
);
// std::string colVal("10");
int
val
=
10
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -217,9 +218,9 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
}
{
std
::
string
colName
(
"test2"
);
std
::
string
colVal
(
"20"
)
;
int
val
=
20
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -229,10 +230,10 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
indexMultiTermDestroy
(
terms
);
}
{
std
::
string
colName
(
"test
2
"
);
std
::
string
colVal
(
"15"
)
;
std
::
string
colName
(
"test"
);
int
val
=
15
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -243,9 +244,9 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
}
{
std
::
string
colName
(
"test2"
);
std
::
string
colVal
(
"15"
)
;
const
char
*
val
=
"test"
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
(
const
char
*
)
val
,
strlen
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -255,12 +256,11 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
indexMultiTermDestroy
(
terms
);
}
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"10"
);
std
::
string
colName
(
"test"
);
int
val
=
15
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
indexMultiTermQueryAdd
(
mq
,
q
,
QUERY_TERM
);
...
...
@@ -270,11 +270,11 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
}
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"10"
)
;
int
val
=
15
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
indexMultiTermQueryAdd
(
mq
,
q
,
QUERY_GREATER_THAN
);
...
...
@@ -284,11 +284,12 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
}
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"10"
);
int
val
=
10
;
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
int
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
indexMultiTermQueryAdd
(
mq
,
q
,
QUERY_GREATER_EQUAL
);
...
...
@@ -298,11 +299,12 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
}
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"10"
);
int
val
=
10
;
// std::string colVal("10");
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
indexMultiTermQueryAdd
(
mq
,
q
,
QUERY_LESS_THAN
);
...
...
@@ -312,11 +314,12 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
}
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"10"
);
int
val
=
10
;
// std::string colVal("10");
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
indexMultiTermQueryAdd
(
mq
,
q
,
QUERY_LESS_EQUAL
);
...
...
@@ -329,9 +332,9 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
TEST_F
(
JsonEnv
,
testWriteJsonTfileAndCache
)
{
{
std
::
string
colName
(
"test1"
);
std
::
string
colVal
(
"10"
)
;
int
val
=
10
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -355,11 +358,11 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache) {
}
{
std
::
string
colName
(
"test1"
);
std
::
string
colVal
(
"10"
)
;
int
val
=
10
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
indexMultiTermQueryAdd
(
mq
,
q
,
QUERY_TERM
);
...
...
@@ -369,11 +372,11 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache) {
}
{
std
::
string
colName
(
"test1"
);
std
::
string
colVal
(
"10"
)
;
int
val
=
10
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
(
));
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
int
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
indexMultiTermQueryAdd
(
mq
,
q
,
QUERY_GREATER_THAN
);
...
...
@@ -426,6 +429,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache) {
{
std
::
string
colName
(
"other_column"
);
std
::
string
colVal
(
"100"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录