Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1f5ad0f1
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1f5ad0f1
编写于
6月 08, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: index support between
上级
098be04a
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
30 addition
and
27 deletion
+30
-27
source/libs/index/inc/indexComm.h
source/libs/index/inc/indexComm.h
+5
-4
source/libs/index/src/.indexFilter.c.swo
source/libs/index/src/.indexFilter.c.swo
+0
-0
source/libs/index/src/index.c
source/libs/index/src/index.c
+2
-2
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+16
-11
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+2
-0
source/libs/index/src/indexTfile.c
source/libs/index/src/indexTfile.c
+2
-7
source/libs/index/test/utilUT.cc
source/libs/index/test/utilUT.cc
+2
-2
tests/script/tsim/stable/tag_filter.sim
tests/script/tsim/stable/tag_filter.sim
+1
-1
未找到文件。
source/libs/index/inc/indexComm.h
浏览文件 @
1f5ad0f1
...
@@ -39,13 +39,14 @@ TExeCond tDoCompare(__compar_fn_t func, int8_t cmpType, void* a, void* b);
...
@@ -39,13 +39,14 @@ TExeCond tDoCompare(__compar_fn_t func, int8_t cmpType, void* a, void* b);
_cache_range_compare
indexGetCompare
(
RangeType
ty
);
_cache_range_compare
indexGetCompare
(
RangeType
ty
);
int32_t
i
nde
xConvertData
(
void
*
src
,
int8_t
type
,
void
**
dst
);
int32_t
i
d
xConvertData
(
void
*
src
,
int8_t
type
,
void
**
dst
);
int32_t
i
nde
xConvertDataToStr
(
void
*
src
,
int8_t
type
,
void
**
dst
);
int32_t
i
d
xConvertDataToStr
(
void
*
src
,
int8_t
type
,
void
**
dst
);
int32_t
i
nde
xGetDataByteLen
(
int8_t
type
);
int32_t
i
d
xGetDataByteLen
(
int8_t
type
);
char
*
i
nde
xInt2str
(
int64_t
val
,
char
*
dst
,
int
radix
);
char
*
i
d
xInt2str
(
int64_t
val
,
char
*
dst
,
int
radix
);
int
idxUidCompare
(
const
void
*
a
,
const
void
*
b
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/index/src/.indexFilter.c.swo
0 → 100644
浏览文件 @
1f5ad0f1
文件已添加
source/libs/index/src/index.c
浏览文件 @
1f5ad0f1
...
@@ -289,7 +289,7 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy
...
@@ -289,7 +289,7 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy
tm
->
nColName
=
nColName
;
tm
->
nColName
=
nColName
;
char
*
buf
=
NULL
;
char
*
buf
=
NULL
;
int32_t
len
=
i
nde
xConvertDataToStr
((
void
*
)
colVal
,
INDEX_TYPE_GET_TYPE
(
colType
),
(
void
**
)
&
buf
);
int32_t
len
=
i
d
xConvertDataToStr
((
void
*
)
colVal
,
INDEX_TYPE_GET_TYPE
(
colType
),
(
void
**
)
&
buf
);
assert
(
len
!=
-
1
);
assert
(
len
!=
-
1
);
tm
->
colVal
=
buf
;
tm
->
colVal
=
buf
;
...
@@ -625,7 +625,7 @@ int32_t indexSerialCacheKey(ICacheKey* key, char* buf) {
...
@@ -625,7 +625,7 @@ int32_t indexSerialCacheKey(ICacheKey* key, char* buf) {
char
*
p
=
buf
;
char
*
p
=
buf
;
char
tbuf
[
65
]
=
{
0
};
char
tbuf
[
65
]
=
{
0
};
i
nde
xInt2str
((
int64_t
)
key
->
suid
,
tbuf
,
0
);
i
d
xInt2str
((
int64_t
)
key
->
suid
,
tbuf
,
0
);
SERIALIZE_STR_VAR_TO_BUF
(
buf
,
tbuf
,
strlen
(
tbuf
));
SERIALIZE_STR_VAR_TO_BUF
(
buf
,
tbuf
,
strlen
(
tbuf
));
SERIALIZE_VAR_TO_BUF
(
buf
,
'_'
,
char
);
SERIALIZE_VAR_TO_BUF
(
buf
,
'_'
,
char
);
...
...
source/libs/index/src/indexComm.c
浏览文件 @
1f5ad0f1
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
char
JSON_COLUMN
[]
=
"JSON"
;
char
JSON_COLUMN
[]
=
"JSON"
;
char
JSON_VALUE_DELIM
=
'&'
;
char
JSON_VALUE_DELIM
=
'&'
;
char
*
i
nde
xInt2str
(
int64_t
val
,
char
*
dst
,
int
radix
)
{
char
*
i
d
xInt2str
(
int64_t
val
,
char
*
dst
,
int
radix
)
{
char
buffer
[
65
]
=
{
0
};
char
buffer
[
65
]
=
{
0
};
char
*
p
;
char
*
p
;
int64_t
new_val
;
int64_t
new_val
;
...
@@ -257,7 +257,12 @@ char* indexPackJsonDataPrefix(SIndexTerm* itm, int32_t* skip) {
...
@@ -257,7 +257,12 @@ char* indexPackJsonDataPrefix(SIndexTerm* itm, int32_t* skip) {
return
buf
;
return
buf
;
}
}
int32_t
indexConvertData
(
void
*
src
,
int8_t
type
,
void
**
dst
)
{
int
idxUidCompare
(
const
void
*
a
,
const
void
*
b
)
{
uint64_t
l
=
*
(
uint64_t
*
)
a
;
uint64_t
r
=
*
(
uint64_t
*
)
b
;
return
l
-
r
;
}
int32_t
idxConvertData
(
void
*
src
,
int8_t
type
,
void
**
dst
)
{
int
tlen
=
-
1
;
int
tlen
=
-
1
;
switch
(
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
...
@@ -342,44 +347,44 @@ int32_t indexConvertData(void* src, int8_t type, void** dst) {
...
@@ -342,44 +347,44 @@ int32_t indexConvertData(void* src, int8_t type, void** dst) {
// indexMayFillNumbericData(*dst, tlen);
// indexMayFillNumbericData(*dst, tlen);
return
tlen
;
return
tlen
;
}
}
int32_t
i
nde
xConvertDataToStr
(
void
*
src
,
int8_t
type
,
void
**
dst
)
{
int32_t
i
d
xConvertDataToStr
(
void
*
src
,
int8_t
type
,
void
**
dst
)
{
int
tlen
=
tDataTypes
[
type
].
bytes
;
int
tlen
=
tDataTypes
[
type
].
bytes
;
int32_t
bufSize
=
64
;
int32_t
bufSize
=
64
;
switch
(
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
i
nde
xInt2str
(
*
(
int64_t
*
)
src
,
*
dst
,
-
1
);
i
d
xInt2str
(
*
(
int64_t
*
)
src
,
*
dst
,
-
1
);
tlen
=
strlen
(
*
dst
);
tlen
=
strlen
(
*
dst
);
break
;
break
;
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
i
nde
xInt2str
(
*
(
uint8_t
*
)
src
,
*
dst
,
1
);
i
d
xInt2str
(
*
(
uint8_t
*
)
src
,
*
dst
,
1
);
tlen
=
strlen
(
*
dst
);
tlen
=
strlen
(
*
dst
);
break
;
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
i
nde
xInt2str
(
*
(
int8_t
*
)
src
,
*
dst
,
1
);
i
d
xInt2str
(
*
(
int8_t
*
)
src
,
*
dst
,
1
);
tlen
=
strlen
(
*
dst
);
tlen
=
strlen
(
*
dst
);
break
;
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
i
nde
xInt2str
(
*
(
int16_t
*
)
src
,
*
dst
,
-
1
);
i
d
xInt2str
(
*
(
int16_t
*
)
src
,
*
dst
,
-
1
);
tlen
=
strlen
(
*
dst
);
tlen
=
strlen
(
*
dst
);
break
;
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
i
nde
xInt2str
(
*
(
uint16_t
*
)
src
,
*
dst
,
-
1
);
i
d
xInt2str
(
*
(
uint16_t
*
)
src
,
*
dst
,
-
1
);
tlen
=
strlen
(
*
dst
);
tlen
=
strlen
(
*
dst
);
break
;
break
;
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_INT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
i
nde
xInt2str
(
*
(
int32_t
*
)
src
,
*
dst
,
-
1
);
i
d
xInt2str
(
*
(
int32_t
*
)
src
,
*
dst
,
-
1
);
tlen
=
strlen
(
*
dst
);
tlen
=
strlen
(
*
dst
);
break
;
break
;
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
i
nde
xInt2str
(
*
(
uint32_t
*
)
src
,
*
dst
,
1
);
i
d
xInt2str
(
*
(
uint32_t
*
)
src
,
*
dst
,
1
);
tlen
=
strlen
(
*
dst
);
tlen
=
strlen
(
*
dst
);
break
;
break
;
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
...
@@ -389,7 +394,7 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
...
@@ -389,7 +394,7 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
break
;
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
i
nde
xInt2str
(
*
(
uint64_t
*
)
src
,
*
dst
,
1
);
i
d
xInt2str
(
*
(
uint64_t
*
)
src
,
*
dst
,
1
);
tlen
=
strlen
(
*
dst
);
tlen
=
strlen
(
*
dst
);
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_FLOAT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
1f5ad0f1
...
@@ -547,6 +547,8 @@ static int32_t sifExecLogic(SLogicConditionNode *node, SIFCtx *ctx, SIFParam *ou
...
@@ -547,6 +547,8 @@ static int32_t sifExecLogic(SLogicConditionNode *node, SIFCtx *ctx, SIFParam *ou
}
else
if
(
node
->
condType
==
LOGIC_COND_TYPE_NOT
)
{
}
else
if
(
node
->
condType
==
LOGIC_COND_TYPE_NOT
)
{
// taosArrayAddAll(output->result, params[m].result);
// taosArrayAddAll(output->result, params[m].result);
}
}
taosArraySort
(
output
->
result
,
idxUidCompare
);
taosArrayRemoveDuplicate
(
output
->
result
,
idxUidCompare
,
NULL
);
}
}
}
else
{
}
else
{
for
(
int32_t
m
=
0
;
m
<
node
->
pParameterList
->
length
;
m
++
)
{
for
(
int32_t
m
=
0
;
m
<
node
->
pParameterList
->
length
;
m
++
)
{
...
...
source/libs/index/src/indexTfile.c
浏览文件 @
1f5ad0f1
...
@@ -578,8 +578,8 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
...
@@ -578,8 +578,8 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
// ugly code, refactor later
// ugly code, refactor later
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
TFileValue
*
v
=
taosArrayGetP
((
SArray
*
)
data
,
i
);
TFileValue
*
v
=
taosArrayGetP
((
SArray
*
)
data
,
i
);
taosArraySort
(
v
->
tableId
,
tfile
UidCompare
);
taosArraySort
(
v
->
tableId
,
idx
UidCompare
);
taosArrayRemoveDuplicate
(
v
->
tableId
,
tfile
UidCompare
,
NULL
);
taosArrayRemoveDuplicate
(
v
->
tableId
,
idx
UidCompare
,
NULL
);
int32_t
tbsz
=
taosArrayGetSize
(
v
->
tableId
);
int32_t
tbsz
=
taosArrayGetSize
(
v
->
tableId
);
fstOffset
+=
TF_TABLE_TATOAL_SIZE
(
tbsz
);
fstOffset
+=
TF_TABLE_TATOAL_SIZE
(
tbsz
);
}
}
...
@@ -791,11 +791,6 @@ TFileReader* tfileGetReaderByCol(IndexTFile* tf, uint64_t suid, char* colName) {
...
@@ -791,11 +791,6 @@ TFileReader* tfileGetReaderByCol(IndexTFile* tf, uint64_t suid, char* colName) {
return
rd
;
return
rd
;
}
}
static
int
tfileUidCompare
(
const
void
*
a
,
const
void
*
b
)
{
uint64_t
l
=
*
(
uint64_t
*
)
a
;
uint64_t
r
=
*
(
uint64_t
*
)
b
;
return
l
-
r
;
}
static
int
tfileStrCompare
(
const
void
*
a
,
const
void
*
b
)
{
static
int
tfileStrCompare
(
const
void
*
a
,
const
void
*
b
)
{
int
ret
=
strcmp
((
char
*
)
a
,
(
char
*
)
b
);
int
ret
=
strcmp
((
char
*
)
a
,
(
char
*
)
b
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
...
...
source/libs/index/test/utilUT.cc
浏览文件 @
1f5ad0f1
...
@@ -327,13 +327,13 @@ TEST_F(UtilEnv, testFill) {
...
@@ -327,13 +327,13 @@ TEST_F(UtilEnv, testFill) {
for
(
int
i
=
0
;
i
<
1000000
;
i
++
)
{
for
(
int
i
=
0
;
i
<
1000000
;
i
++
)
{
int64_t
val
=
i
;
int64_t
val
=
i
;
char
buf
[
65
]
=
{
0
};
char
buf
[
65
]
=
{
0
};
i
nde
xInt2str
(
val
,
buf
,
1
);
i
d
xInt2str
(
val
,
buf
,
1
);
EXPECT_EQ
(
val
,
taosStr2int64
(
buf
));
EXPECT_EQ
(
val
,
taosStr2int64
(
buf
));
}
}
for
(
int
i
=
0
;
i
<
1000000
;
i
++
)
{
for
(
int
i
=
0
;
i
<
1000000
;
i
++
)
{
int64_t
val
=
0
-
i
;
int64_t
val
=
0
-
i
;
char
buf
[
65
]
=
{
0
};
char
buf
[
65
]
=
{
0
};
i
nde
xInt2str
(
val
,
buf
,
-
1
);
i
d
xInt2str
(
val
,
buf
,
-
1
);
EXPECT_EQ
(
val
,
taosStr2int64
(
buf
));
EXPECT_EQ
(
val
,
taosStr2int64
(
buf
));
}
}
}
}
...
...
tests/script/tsim/stable/tag_filter.sim
浏览文件 @
1f5ad0f1
...
@@ -25,7 +25,7 @@ sql insert into db.ctb5 values(now, 5, "2")
...
@@ -25,7 +25,7 @@ sql insert into db.ctb5 values(now, 5, "2")
sql create table db.ctb6 using db.stb tags(6, "102")
sql create table db.ctb6 using db.stb tags(6, "102")
sql insert into db.ctb6 values(now, 6, "2")
sql insert into db.ctb6 values(now, 6, "2")
// int
sql select * from db.stb where t1 = 1
sql select * from db.stb where t1 = 1
if $rows != 1 then
if $rows != 1 then
return -1
return -1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录