Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5ed7b44b
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
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看板
提交
5ed7b44b
编写于
5月 04, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(index): support index filter
上级
dc6bdab4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
64 addition
and
11 deletion
+64
-11
include/libs/index/index.h
include/libs/index/index.h
+11
-1
source/libs/executor/src/indexoperator.c
source/libs/executor/src/indexoperator.c
+8
-6
source/libs/index/inc/indexCache.h
source/libs/index/inc/indexCache.h
+1
-0
source/libs/index/inc/indexInt.h
source/libs/index/inc/indexInt.h
+0
-1
source/libs/index/src/index.c
source/libs/index/src/index.c
+0
-1
source/libs/index/src/indexCache.c
source/libs/index/src/indexCache.c
+22
-1
source/libs/index/src/indexTfile.c
source/libs/index/src/indexTfile.c
+22
-1
未找到文件。
include/libs/index/index.h
浏览文件 @
5ed7b44b
...
@@ -47,7 +47,17 @@ typedef enum {
...
@@ -47,7 +47,17 @@ typedef enum {
}
SIndexOperOnColumn
;
}
SIndexOperOnColumn
;
typedef
enum
{
MUST
=
0
,
SHOULD
,
NOT
}
EIndexOperatorType
;
typedef
enum
{
MUST
=
0
,
SHOULD
,
NOT
}
EIndexOperatorType
;
typedef
enum
{
QUERY_TERM
=
0
,
QUERY_PREFIX
,
QUERY_SUFFIX
,
QUERY_REGEX
,
QUERY_RANGE
}
EIndexQueryType
;
typedef
enum
{
QUERY_TERM
=
0
,
QUERY_PREFIX
,
QUERY_SUFFIX
,
QUERY_REGEX
,
QUERY_LESS_THAN
,
QUERY_LESS_EQUAL
,
QUERY_GREATER_THAN
,
QUERY_GREATER_EQUAL
,
QUERY_RANGE
}
EIndexQueryType
;
/*
/*
* create multi query
* create multi query
...
...
source/libs/executor/src/indexoperator.c
浏览文件 @
5ed7b44b
...
@@ -63,9 +63,14 @@ typedef struct SIFParam {
...
@@ -63,9 +63,14 @@ typedef struct SIFParam {
}
SIFParam
;
}
SIFParam
;
static
int32_t
sifGetFuncFromSql
(
EOperatorType
src
,
EIndexQueryType
*
dst
)
{
static
int32_t
sifGetFuncFromSql
(
EOperatorType
src
,
EIndexQueryType
*
dst
)
{
if
(
src
==
OP_TYPE_GREATER_THAN
||
src
==
OP_TYPE_GREATER_EQUAL
||
src
==
OP_TYPE_LOWER_THAN
||
if
(
src
==
OP_TYPE_GREATER_THAN
)
{
src
==
OP_TYPE_LOWER_EQUAL
)
{
*
dst
=
QUERY_GREATER_THAN
;
*
dst
=
QUERY_RANGE
;
}
else
if
(
src
==
OP_TYPE_GREATER_EQUAL
)
{
*
dst
=
QUERY_GREATER_EQUAL
;
}
else
if
(
src
==
OP_TYPE_LOWER_THAN
)
{
*
dst
=
QUERY_LESS_THAN
;
}
else
if
(
src
==
OP_TYPE_LOWER_EQUAL
)
{
*
dst
=
QUERY_LESS_EQUAL
;
}
else
if
(
src
==
OP_TYPE_EQUAL
)
{
}
else
if
(
src
==
OP_TYPE_EQUAL
)
{
*
dst
=
QUERY_TERM
;
*
dst
=
QUERY_TERM
;
}
else
if
(
src
==
OP_TYPE_LIKE
||
src
==
OP_TYPE_MATCH
||
src
==
OP_TYPE_NMATCH
)
{
}
else
if
(
src
==
OP_TYPE_LIKE
||
src
==
OP_TYPE_MATCH
||
src
==
OP_TYPE_NMATCH
)
{
...
@@ -249,9 +254,6 @@ static int32_t sifExecFunction(SFunctionNode *node, SIFCtx *ctx, SIFParam *outpu
...
@@ -249,9 +254,6 @@ static int32_t sifExecFunction(SFunctionNode *node, SIFCtx *ctx, SIFParam *outpu
static
int32_t
sifDoIndex
(
SIFParam
*
left
,
SIFParam
*
right
,
int8_t
operType
,
SIFParam
*
output
)
{
static
int32_t
sifDoIndex
(
SIFParam
*
left
,
SIFParam
*
right
,
int8_t
operType
,
SIFParam
*
output
)
{
SIndexTerm
*
tm
=
indexTermCreate
(
left
->
suid
,
DEFAULT
,
operType
,
left
->
colValType
,
left
->
colName
,
SIndexTerm
*
tm
=
indexTermCreate
(
left
->
suid
,
DEFAULT
,
operType
,
left
->
colValType
,
left
->
colName
,
strlen
(
left
->
colName
),
right
->
condValue
,
strlen
(
right
->
condValue
));
strlen
(
left
->
colName
),
right
->
condValue
,
strlen
(
right
->
condValue
));
if
(
operType
==
OP_TYPE_LOWER_EQUAL
||
operType
==
OP_TYPE_GREATER_EQUAL
||
operType
==
OP_TYPE_GREATER_THAN
||
operType
==
OP_TYPE_LOWER_THAN
)
{
}
if
(
tm
==
NULL
)
{
if
(
tm
==
NULL
)
{
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
}
...
...
source/libs/index/inc/indexCache.h
浏览文件 @
5ed7b44b
...
@@ -56,6 +56,7 @@ typedef struct CacheTerm {
...
@@ -56,6 +56,7 @@ typedef struct CacheTerm {
int8_t
colType
;
int8_t
colType
;
SIndexOperOnColumn
operaType
;
SIndexOperOnColumn
operaType
;
int8_t
qType
;
// query type
}
CacheTerm
;
}
CacheTerm
;
//
//
...
...
source/libs/index/inc/indexInt.h
浏览文件 @
5ed7b44b
...
@@ -86,7 +86,6 @@ typedef struct SIndexTerm {
...
@@ -86,7 +86,6 @@ typedef struct SIndexTerm {
int32_t
nColName
;
int32_t
nColName
;
char
*
colVal
;
char
*
colVal
;
int32_t
nColVal
;
int32_t
nColVal
;
int8_t
qType
;
// just use for range
}
SIndexTerm
;
}
SIndexTerm
;
typedef
struct
SIndexTermQuery
{
typedef
struct
SIndexTermQuery
{
...
...
source/libs/index/src/index.c
浏览文件 @
5ed7b44b
...
@@ -262,7 +262,6 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, int8_t queryT
...
@@ -262,7 +262,6 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, int8_t queryT
tm
->
colVal
=
(
char
*
)
taosMemoryCalloc
(
1
,
nColVal
+
1
);
tm
->
colVal
=
(
char
*
)
taosMemoryCalloc
(
1
,
nColVal
+
1
);
memcpy
(
tm
->
colVal
,
colVal
,
nColVal
);
memcpy
(
tm
->
colVal
,
colVal
,
nColVal
);
tm
->
nColVal
=
nColVal
;
tm
->
nColVal
=
nColVal
;
tm
->
qType
=
queryType
;
return
tm
;
return
tm
;
}
}
...
...
source/libs/index/src/indexCache.c
浏览文件 @
5ed7b44b
...
@@ -38,10 +38,15 @@ static int32_t cacheSearchTerm(void* cache, CacheTerm* ct, SIdxTempResult* tr, S
...
@@ -38,10 +38,15 @@ static int32_t cacheSearchTerm(void* cache, CacheTerm* ct, SIdxTempResult* tr, S
static
int32_t
cacheSearchPrefix
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchPrefix
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchSuffix
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchSuffix
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchRegex
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchRegex
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchLessThan
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchLessEqual
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchGreaterThan
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchGreaterEqual
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchRange
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
cacheSearchRange
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
);
static
int32_t
(
*
cacheSearch
[])(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
)
=
{
static
int32_t
(
*
cacheSearch
[])(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
)
=
{
cacheSearchTerm
,
cacheSearchPrefix
,
cacheSearchSuffix
,
cacheSearchRegex
,
cacheSearchRange
};
cacheSearchTerm
,
cacheSearchPrefix
,
cacheSearchSuffix
,
cacheSearchRegex
,
cacheSearchLessThan
,
cacheSearchLessEqual
,
cacheSearchGreaterThan
,
cacheSearchGreaterEqual
,
cacheSearchRange
};
static
void
doMergeWork
(
SSchedMsg
*
msg
);
static
void
doMergeWork
(
SSchedMsg
*
msg
);
static
bool
indexCacheIteratorNext
(
Iterate
*
itera
);
static
bool
indexCacheIteratorNext
(
Iterate
*
itera
);
...
@@ -88,6 +93,22 @@ static int32_t cacheSearchRegex(void* cache, CacheTerm* ct, SIdxTempResult* tr,
...
@@ -88,6 +93,22 @@ static int32_t cacheSearchRegex(void* cache, CacheTerm* ct, SIdxTempResult* tr,
// impl later
// impl later
return
0
;
return
0
;
}
}
static
int32_t
cacheSearchLessThan
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
)
{
// impl later
return
0
;
}
static
int32_t
cacheSearchLessEqual
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
)
{
// impl later
return
0
;
}
static
int32_t
cacheSearchGreaterThan
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
)
{
// impl later
return
0
;
}
static
int32_t
cacheSearchGreaterEqual
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
)
{
// impl later
return
0
;
}
static
int32_t
cacheSearchRange
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
)
{
static
int32_t
cacheSearchRange
(
void
*
cache
,
CacheTerm
*
ct
,
SIdxTempResult
*
tr
,
STermValueType
*
s
)
{
// impl later
// impl later
return
0
;
return
0
;
...
...
source/libs/index/src/indexTfile.c
浏览文件 @
5ed7b44b
...
@@ -64,10 +64,15 @@ static int32_t tfSearchTerm(void* reader, SIndexTerm* tem, SIdxTempResult* tr);
...
@@ -64,10 +64,15 @@ static int32_t tfSearchTerm(void* reader, SIndexTerm* tem, SIdxTempResult* tr);
static
int32_t
tfSearchPrefix
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchPrefix
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchSuffix
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchSuffix
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchRegex
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchRegex
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchLessThan
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchLessEqual
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchGreaterThan
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchGreaterEqual
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchRange
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
tfSearchRange
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
);
static
int32_t
(
*
tfSearch
[])(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
)
=
{
static
int32_t
(
*
tfSearch
[])(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
)
=
{
tfSearchTerm
,
tfSearchPrefix
,
tfSearchSuffix
,
tfSearchRegex
,
tfSearchRange
};
tfSearchTerm
,
tfSearchPrefix
,
tfSearchSuffix
,
tfSearchRegex
,
tfSearchLessThan
,
tfSearchLessEqual
,
tfSearchGreaterThan
,
tfSearchGreaterEqual
,
tfSearchRange
};
TFileCache
*
tfileCacheCreate
(
const
char
*
path
)
{
TFileCache
*
tfileCacheCreate
(
const
char
*
path
)
{
TFileCache
*
tcache
=
taosMemoryCalloc
(
1
,
sizeof
(
TFileCache
));
TFileCache
*
tcache
=
taosMemoryCalloc
(
1
,
sizeof
(
TFileCache
));
...
@@ -299,6 +304,22 @@ static int32_t tfSearchRegex(void* reader, SIndexTerm* tem, SIdxTempResult* tr)
...
@@ -299,6 +304,22 @@ static int32_t tfSearchRegex(void* reader, SIndexTerm* tem, SIdxTempResult* tr)
fstSliceDestroy
(
&
key
);
fstSliceDestroy
(
&
key
);
return
0
;
return
0
;
}
}
static
int32_t
tfSearchLessThan
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
)
{
// impl later
return
0
;
}
static
int32_t
tfSearchLessEqual
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
)
{
// impl later
return
0
;
}
static
int32_t
tfSearchGreaterThan
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
)
{
// impl later
return
0
;
}
static
int32_t
tfSearchGreaterEqual
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
)
{
// impl later
return
0
;
}
static
int32_t
tfSearchRange
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
)
{
static
int32_t
tfSearchRange
(
void
*
reader
,
SIndexTerm
*
tem
,
SIdxTempResult
*
tr
)
{
bool
hasJson
=
INDEX_TYPE_CONTAIN_EXTERN_TYPE
(
tem
->
colType
,
TSDB_DATA_TYPE_JSON
);
bool
hasJson
=
INDEX_TYPE_CONTAIN_EXTERN_TYPE
(
tem
->
colType
,
TSDB_DATA_TYPE_JSON
);
int
ret
=
0
;
int
ret
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录