Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ab907e33
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看板
提交
ab907e33
编写于
5月 24, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): fix syntax error.
上级
fe097058
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
48 addition
and
48 deletion
+48
-48
include/libs/executor/storageapi.h
include/libs/executor/storageapi.h
+3
-3
include/libs/index/index.h
include/libs/index/index.h
+17
-17
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+2
-14
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+4
-3
source/dnode/vnode/src/vnd/vnodeInitApi.c
source/dnode/vnode/src/vnd/vnodeInitApi.c
+6
-0
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+1
-1
source/libs/executor/src/sysscanoperator.c
source/libs/executor/src/sysscanoperator.c
+1
-1
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+13
-8
source/libs/qworker/test/CMakeLists.txt
source/libs/qworker/test/CMakeLists.txt
+1
-1
未找到文件。
include/libs/executor/storageapi.h
浏览文件 @
ab907e33
...
...
@@ -354,13 +354,13 @@ typedef struct SStoreMetaReader {
}
SStoreMetaReader
;
typedef
struct
SStoreMeta
{
SMTbCursor
*
(
*
openTableMetaCursor
)();
// metaOpenTbCursor
void
(
*
closeTableMetaCursor
)();
// metaCloseTbCursor
SMTbCursor
*
(
*
openTableMetaCursor
)(
void
*
pVnode
);
// metaOpenTbCursor
void
(
*
closeTableMetaCursor
)(
SMTbCursor
*
pTbCur
);
// metaCloseTbCursor
int32_t
(
*
cursorNext
)();
// metaTbCursorNext
int32_t
(
*
cursorPrev
)();
// metaTbCursorPrev
int32_t
(
*
getTableTags
)(
void
*
pVnode
,
uint64_t
suid
,
SArray
*
uidList
);
int32_t
(
*
getTableTagsByUid
)();
int32_t
(
*
getTableTagsByUid
)(
void
*
pVnode
,
int64_t
suid
,
SArray
*
uidList
);
const
void
*
(
*
extractTagVal
)(
const
void
*
tag
,
int16_t
type
,
STagVal
*
tagVal
);
// todo remove it
int32_t
(
*
getTableUidByName
)(
void
*
pVnode
,
char
*
tbName
,
uint64_t
*
uid
);
...
...
include/libs/index/index.h
浏览文件 @
ab907e33
...
...
@@ -215,23 +215,6 @@ typedef struct SIndexMetaArg {
int
(
*
metaFilterFunc
)(
void
*
metaEx
,
void
*
param
,
SArray
*
result
);
}
SIndexMetaArg
;
typedef
enum
{
SFLT_NOT_INDEX
,
SFLT_COARSE_INDEX
,
SFLT_ACCURATE_INDEX
}
SIdxFltStatus
;
SIdxFltStatus
idxGetFltStatus
(
SNode
*
pFilterNode
);
int32_t
doFilterTag
(
SNode
*
pFilterNode
,
SIndexMetaArg
*
metaArg
,
SArray
*
result
,
SIdxFltStatus
*
status
);
/*
* init index env
*
*/
void
indexInit
(
int32_t
threads
);
/*
* destory index env
*
*/
void
indexCleanup
();
/**
* the underlying storage module must implement this API to employ the index functions.
* @param pMeta
...
...
@@ -256,6 +239,23 @@ typedef struct SMetaDataFilterAPI {
int32_t
(
*
metaFilterTtl
)(
void
*
pVnode
,
SMetaFltParam
*
arg
,
SArray
*
pUids
);
}
SMetaDataFilterAPI
;
typedef
enum
{
SFLT_NOT_INDEX
,
SFLT_COARSE_INDEX
,
SFLT_ACCURATE_INDEX
}
SIdxFltStatus
;
SIdxFltStatus
idxGetFltStatus
(
SNode
*
pFilterNode
,
SMetaDataFilterAPI
*
pAPI
);
int32_t
doFilterTag
(
SNode
*
pFilterNode
,
SIndexMetaArg
*
metaArg
,
SArray
*
result
,
SIdxFltStatus
*
status
,
SMetaDataFilterAPI
*
pAPI
);
/*
* init index env
*
*/
void
indexInit
(
int32_t
threads
);
/*
* destory index env
*
*/
void
indexCleanup
();
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
ab907e33
...
...
@@ -111,8 +111,8 @@ void metaReaderClear(SMetaReader *pReader);
int32_t
metaReaderGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
);
int32_t
metaReaderGetTableEntryByUidCache
(
SMetaReader
*
pReader
,
tb_uid_t
uid
);
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
);
int32_t
metaGetTableTags
(
SMeta
*
pMeta
,
uint64_t
suid
,
SArray
*
uidList
);
int32_t
metaGetTableTagsByUids
(
SMeta
*
pMeta
,
int64_t
suid
,
SArray
*
uidList
);
int32_t
metaGetTableTags
(
void
*
pVnode
,
uint64_t
suid
,
SArray
*
uidList
);
int32_t
metaGetTableTagsByUids
(
void
*
pVnode
,
int64_t
suid
,
SArray
*
uidList
);
int32_t
metaReadNext
(
SMetaReader
*
pReader
);
const
void
*
metaGetTableTagVal
(
const
void
*
tag
,
int16_t
type
,
STagVal
*
tagVal
);
int
metaGetTableNameByUid
(
void
*
meta
,
uint64_t
uid
,
char
*
tbName
);
...
...
@@ -140,18 +140,6 @@ int64_t metaGetNtbNum(SMeta *pMeta);
//} SMetaStbStats;
int32_t
metaGetStbStats
(
void
*
pVnode
,
int64_t
uid
,
int64_t
*
numOfTables
);
//typedef struct SMetaFltParam {
// tb_uid_t suid;
// int16_t cid;
// int16_t type;
// void *val;
// bool reverse;
// bool equal;
// int (*filterFunc)(void *a, void *b, int16_t type);
//
//} SMetaFltParam;
#if 1 // refact APIs below (TODO)
typedef
SVCreateTbReq
STbCfg
;
typedef
SVCreateTSmaReq
SSmaCfg
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
ab907e33
...
...
@@ -1356,7 +1356,8 @@ static int32_t metaGetTableTagByUid(SMeta *pMeta, int64_t suid, int64_t uid, voi
return
ret
;
}
int32_t
metaGetTableTagsByUids
(
SMeta
*
pMeta
,
int64_t
suid
,
SArray
*
uidList
)
{
int32_t
metaGetTableTagsByUids
(
void
*
pVnode
,
int64_t
suid
,
SArray
*
uidList
)
{
SMeta
*
pMeta
=
((
SVnode
*
)
pVnode
)
->
pMeta
;
const
int32_t
LIMIT
=
128
;
int32_t
isLock
=
false
;
...
...
@@ -1388,8 +1389,8 @@ int32_t metaGetTableTagsByUids(SMeta *pMeta, int64_t suid, SArray *uidList) {
return
0
;
}
int32_t
metaGetTableTags
(
SMeta
*
pMeta
,
uint64_t
suid
,
SArray
*
pUidTagInfo
)
{
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
pMeta
,
suid
,
1
);
int32_t
metaGetTableTags
(
void
*
pVnode
,
uint64_t
suid
,
SArray
*
pUidTagInfo
)
{
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
((
SVnode
*
)
pVnode
)
->
pMeta
,
suid
,
1
);
// If len > 0 means there already have uids, and we only want the
// tags of the specified tables, of which uid in the uid list. Otherwise, all table tags are retrieved and kept
...
...
source/dnode/vnode/src/vnd/vnodeInitApi.c
浏览文件 @
ab907e33
...
...
@@ -72,6 +72,12 @@ void initMetadataAPI(SStoreMeta* pMeta) {
pMeta
->
getInvertIndex
=
vnodeGetIvtIdx
;
pMeta
->
extractTagVal
=
(
const
void
*
(
*
)(
const
void
*
,
int16_t
,
STagVal
*
))
metaGetTableTagVal
;
pMeta
->
getTableTags
=
metaGetTableTags
;
pMeta
->
getTableTagsByUid
=
metaGetTableTagsByUids
;
pMeta
->
getTableUidByName
=
metaGetTableUidByName
;
pMeta
->
getTableTypeByName
=
metaGetTableTypeByName
;
pMeta
->
getTableNameByUid
=
metaGetTableNameByUid
;
}
void
initTqAPI
(
SStoreTqReader
*
pTq
)
{
...
...
source/libs/executor/src/executil.c
浏览文件 @
ab907e33
...
...
@@ -1100,7 +1100,7 @@ int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, S
.
metaEx
=
pVnode
,
.
idx
=
pStorageAPI
->
metaFn
.
storeGetIndexInfo
(
pVnode
),
.
ivtIdx
=
pIndex
,
.
suid
=
pScanNode
->
uid
};
status
=
SFLT_NOT_INDEX
;
code
=
doFilterTag
(
pTagIndexCond
,
&
metaArg
,
pUidList
,
&
status
);
code
=
doFilterTag
(
pTagIndexCond
,
&
metaArg
,
pUidList
,
&
status
,
&
pStorageAPI
->
metaFilter
);
if
(
code
!=
0
||
status
==
SFLT_NOT_INDEX
)
{
// temporarily disable it for performance sake
qWarn
(
"failed to get tableIds from index, suid:%"
PRIu64
,
pScanNode
->
uid
);
code
=
TSDB_CODE_SUCCESS
;
...
...
source/libs/executor/src/sysscanoperator.c
浏览文件 @
ab907e33
...
...
@@ -1485,7 +1485,7 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
}
else
{
if
(
pInfo
->
showRewrite
==
false
)
{
if
(
pCondition
!=
NULL
&&
pInfo
->
pIdx
==
NULL
)
{
SSTabFltArg
arg
=
{.
pMeta
=
pInfo
->
readHandle
.
vnode
,
.
pVnode
=
pInfo
->
readHandle
.
vnode
};
SSTabFltArg
arg
=
{.
pMeta
=
pInfo
->
readHandle
.
vnode
,
.
pVnode
=
pInfo
->
readHandle
.
vnode
,
.
pAPI
=
&
pTaskInfo
->
storageAPI
};
SSysTableIndex
*
idx
=
taosMemoryMalloc
(
sizeof
(
SSysTableIndex
));
idx
->
init
=
0
;
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
ab907e33
...
...
@@ -86,6 +86,7 @@ typedef struct SIFCtx {
SHashObj
*
pRes
;
/* element is SIFParam */
bool
noExec
;
// true: just iterate condition tree, and add hint to executor plan
SIndexMetaArg
arg
;
SMetaDataFilterAPI
*
pAPI
;
}
SIFCtx
;
static
FORCE_INLINE
int32_t
sifGetFuncFromSql
(
EOperatorType
src
,
EIndexQueryType
*
dst
)
{
...
...
@@ -288,6 +289,8 @@ static int32_t sifInitParamValByCol(SNode *r, SNode *l, SIFParam *param, SIFCtx
}
static
int32_t
sifInitParam
(
SNode
*
node
,
SIFParam
*
param
,
SIFCtx
*
ctx
)
{
param
->
status
=
SFLT_COARSE_INDEX
;
param
->
api
=
*
ctx
->
pAPI
;
switch
(
nodeType
(
node
))
{
case
QUERY_NODE_VALUE
:
{
SValueNode
*
vn
=
(
SValueNode
*
)
node
;
...
...
@@ -364,6 +367,7 @@ static int32_t sifInitOperParams(SIFParam **params, SOperatorNode *node, SIFCtx
SIF_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
}
SIFParam
*
paramList
=
taosMemoryCalloc
(
nParam
,
sizeof
(
SIFParam
));
if
(
NULL
==
paramList
)
{
...
...
@@ -972,8 +976,9 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
if
(
pNode
==
NULL
||
pDst
==
NULL
)
{
return
TSDB_CODE_QRY_INVALID_INPUT
;
}
int32_t
code
=
0
;
SIFCtx
ctx
=
{.
code
=
0
,
.
noExec
=
false
,
.
arg
=
pDst
->
arg
};
SIFCtx
ctx
=
{.
code
=
0
,
.
noExec
=
false
,
.
arg
=
pDst
->
arg
,
.
pAPI
=
&
pDst
->
api
};
ctx
.
pRes
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
if
(
NULL
==
ctx
.
pRes
)
{
...
...
@@ -1006,13 +1011,13 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
return
code
;
}
static
int32_t
sifGetFltHint
(
SNode
*
pNode
,
SIdxFltStatus
*
status
)
{
static
int32_t
sifGetFltHint
(
SNode
*
pNode
,
SIdxFltStatus
*
status
,
SMetaDataFilterAPI
*
pAPI
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
pNode
==
NULL
)
{
return
TSDB_CODE_QRY_INVALID_INPUT
;
}
SIFCtx
ctx
=
{.
code
=
0
,
.
noExec
=
true
};
SIFCtx
ctx
=
{.
code
=
0
,
.
noExec
=
true
,
.
pAPI
=
pAPI
};
ctx
.
pRes
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
if
(
NULL
==
ctx
.
pRes
)
{
indexError
(
"index-filter failed to taosHashInit"
);
...
...
@@ -1044,8 +1049,8 @@ static int32_t sifGetFltHint(SNode *pNode, SIdxFltStatus *status) {
return
code
;
}
int32_t
doFilterTag
(
SNode
*
pFilterNode
,
SIndexMetaArg
*
metaArg
,
SArray
*
result
,
SIdxFltStatus
*
status
)
{
SIdxFltStatus
st
=
idxGetFltStatus
(
pFilterNode
);
int32_t
doFilterTag
(
SNode
*
pFilterNode
,
SIndexMetaArg
*
metaArg
,
SArray
*
result
,
SIdxFltStatus
*
status
,
SMetaDataFilterAPI
*
pAPI
)
{
SIdxFltStatus
st
=
idxGetFltStatus
(
pFilterNode
,
pAPI
);
if
(
st
==
SFLT_NOT_INDEX
)
{
*
status
=
st
;
return
0
;
...
...
@@ -1054,7 +1059,7 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
SFilterInfo
*
filter
=
NULL
;
SArray
*
output
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
SIFParam
param
=
{.
arg
=
*
metaArg
,
.
result
=
output
,
.
status
=
SFLT_NOT_INDEX
};
SIFParam
param
=
{.
arg
=
*
metaArg
,
.
result
=
output
,
.
status
=
SFLT_NOT_INDEX
,
.
api
=
*
pAPI
};
int32_t
code
=
sifCalculate
((
SNode
*
)
pFilterNode
,
&
param
);
if
(
code
!=
0
)
{
sifFreeParam
(
&
param
);
...
...
@@ -1071,13 +1076,13 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
return
TSDB_CODE_SUCCESS
;
}
SIdxFltStatus
idxGetFltStatus
(
SNode
*
pFilterNode
)
{
SIdxFltStatus
idxGetFltStatus
(
SNode
*
pFilterNode
,
SMetaDataFilterAPI
*
pAPI
)
{
SIdxFltStatus
st
=
SFLT_NOT_INDEX
;
if
(
pFilterNode
==
NULL
)
{
return
SFLT_NOT_INDEX
;
}
if
(
sifGetFltHint
((
SNode
*
)
pFilterNode
,
&
st
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
sifGetFltHint
((
SNode
*
)
pFilterNode
,
&
st
,
pAPI
)
!=
TSDB_CODE_SUCCESS
)
{
st
=
SFLT_NOT_INDEX
;
}
return
st
;
...
...
source/libs/qworker/test/CMakeLists.txt
浏览文件 @
ab907e33
...
...
@@ -8,7 +8,7 @@ IF(NOT TD_DARWIN)
ADD_EXECUTABLE
(
qworkerTest
${
SOURCE_LIST
}
)
TARGET_LINK_LIBRARIES
(
qworkerTest
PUBLIC os util common transport gtest qcom nodes planner qworker executor
PUBLIC os util common transport gtest qcom nodes planner qworker executor
index
)
TARGET_INCLUDE_DIRECTORIES
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录