Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8dc6d1cc
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8dc6d1cc
编写于
6月 13, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change log level when filter tag
上级
856f1ed7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
30 deletion
+41
-30
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+41
-30
未找到文件。
source/libs/executor/src/executil.c
浏览文件 @
8dc6d1cc
...
...
@@ -26,8 +26,8 @@
#include "executil.h"
#include "executorInt.h"
#include "querytask.h"
#include "tcompression.h"
#include "storageapi.h"
#include "tcompression.h"
typedef
struct
tagFilterAssist
{
SHashObj
*
colHash
;
...
...
@@ -42,13 +42,13 @@ typedef enum {
}
FilterCondType
;
static
FilterCondType
checkTagCond
(
SNode
*
cond
);
static
int32_t
optimizeTbnameInCond
(
void
*
metaHandle
,
int64_t
suid
,
SArray
*
list
,
SNode
*
pTagCond
,
SStorageAPI
*
pAPI
);
static
int32_t
optimizeTbnameInCondImpl
(
void
*
metaHandle
,
SArray
*
list
,
SNode
*
pTagCond
,
SStorageAPI
*
pStoreAPI
);
static
int32_t
optimizeTbnameInCond
(
void
*
metaHandle
,
int64_t
suid
,
SArray
*
list
,
SNode
*
pTagCond
,
SStorageAPI
*
pAPI
);
static
int32_t
optimizeTbnameInCondImpl
(
void
*
metaHandle
,
SArray
*
list
,
SNode
*
pTagCond
,
SStorageAPI
*
pStoreAPI
);
static
int32_t
getTableList
(
void
*
pVnode
,
SScanPhysiNode
*
pScanNode
,
SNode
*
pTagCond
,
S
Node
*
pTagIndexCond
,
S
TableListInfo
*
pListInfo
,
uint8_t
*
digest
,
const
char
*
idstr
,
SStorageAPI
*
pStorageAPI
);
static
SSDataBlock
*
createTagValBlockForFilter
(
SArray
*
pColList
,
int32_t
numOfTables
,
SArray
*
pUidTagList
,
void
*
pVnode
,
SStorageAPI
*
pStorageAPI
);
static
int32_t
getTableList
(
void
*
pVnode
,
SScanPhysiNode
*
pScanNode
,
SNode
*
pTagCond
,
SNode
*
pTagIndexCond
,
STableListInfo
*
pListInfo
,
uint8_t
*
digest
,
const
char
*
idstr
,
SStorageAPI
*
pStorageAPI
);
static
SSDataBlock
*
createTagValBlockForFilter
(
SArray
*
pColList
,
int32_t
numOfTables
,
SArray
*
pUidTagList
,
void
*
pVnode
,
SStorageAPI
*
pStorageAPI
);
static
int64_t
getLimit
(
const
SNode
*
pLimit
)
{
return
NULL
==
pLimit
?
-
1
:
((
SLimitNode
*
)
pLimit
)
->
limit
;
}
static
int64_t
getOffset
(
const
SNode
*
pLimit
)
{
return
NULL
==
pLimit
?
-
1
:
((
SLimitNode
*
)
pLimit
)
->
offset
;
}
...
...
@@ -302,7 +302,7 @@ EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) {
return
DEAL_RES_CONTINUE
;
}
int32_t
isQualifiedTable
(
STableKeyInfo
*
info
,
SNode
*
pTagCond
,
void
*
metaHandle
,
bool
*
pQualified
,
SStorageAPI
*
pAPI
)
{
int32_t
isQualifiedTable
(
STableKeyInfo
*
info
,
SNode
*
pTagCond
,
void
*
metaHandle
,
bool
*
pQualified
,
SStorageAPI
*
pAPI
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SMetaReader
mr
=
{
0
};
...
...
@@ -495,7 +495,8 @@ int32_t getColInfoResultForGroupby(void* pVnode, SNodeList* group, STableListInf
genTbGroupDigest
((
SNode
*
)
listNode
,
digest
,
&
context
);
nodesFree
(
listNode
);
pAPI
->
metaFn
.
metaGetCachedTbGroup
(
pVnode
,
pTableListInfo
->
idInfo
.
suid
,
context
.
digest
,
tListLen
(
context
.
digest
),
&
tableList
);
pAPI
->
metaFn
.
metaGetCachedTbGroup
(
pVnode
,
pTableListInfo
->
idInfo
.
suid
,
context
.
digest
,
tListLen
(
context
.
digest
),
&
tableList
);
if
(
tableList
)
{
taosArrayDestroy
(
pTableListInfo
->
pTableList
);
pTableListInfo
->
pTableList
=
tableList
;
...
...
@@ -632,7 +633,8 @@ int32_t getColInfoResultForGroupby(void* pVnode, SNodeList* group, STableListInf
if
(
tsTagFilterCache
)
{
tableList
=
taosArrayDup
(
pTableListInfo
->
pTableList
,
NULL
);
pAPI
->
metaFn
.
metaPutTbGroupToCache
(
pVnode
,
pTableListInfo
->
idInfo
.
suid
,
context
.
digest
,
tListLen
(
context
.
digest
),
tableList
,
taosArrayGetSize
(
tableList
)
*
sizeof
(
STableKeyInfo
));
pAPI
->
metaFn
.
metaPutTbGroupToCache
(
pVnode
,
pTableListInfo
->
idInfo
.
suid
,
context
.
digest
,
tListLen
(
context
.
digest
),
tableList
,
taosArrayGetSize
(
tableList
)
*
sizeof
(
STableKeyInfo
));
}
// int64_t st2 = taosGetTimestampUs();
...
...
@@ -776,7 +778,8 @@ static int32_t optimizeTbnameInCond(void* pVnode, int64_t suid, SArray* list, SN
}
// only return uid that does not contained in pExistedUidList
static
int32_t
optimizeTbnameInCondImpl
(
void
*
pVnode
,
SArray
*
pExistedUidList
,
SNode
*
pTagCond
,
SStorageAPI
*
pStoreAPI
)
{
static
int32_t
optimizeTbnameInCondImpl
(
void
*
pVnode
,
SArray
*
pExistedUidList
,
SNode
*
pTagCond
,
SStorageAPI
*
pStoreAPI
)
{
if
(
nodeType
(
pTagCond
)
!=
QUERY_NODE_OPERATOR
)
{
return
-
1
;
}
...
...
@@ -839,8 +842,8 @@ static int32_t optimizeTbnameInCondImpl(void* pVnode, SArray* pExistedUidList, S
return
-
1
;
}
static
SSDataBlock
*
createTagValBlockForFilter
(
SArray
*
pColList
,
int32_t
numOfTables
,
SArray
*
pUidTagList
,
void
*
pVnode
,
SStorageAPI
*
pStorageAPI
)
{
static
SSDataBlock
*
createTagValBlockForFilter
(
SArray
*
pColList
,
int32_t
numOfTables
,
SArray
*
pUidTagList
,
void
*
pVnode
,
SStorageAPI
*
pStorageAPI
)
{
SSDataBlock
*
pResBlock
=
createDataBlock
();
if
(
pResBlock
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -1080,8 +1083,8 @@ int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, S
genTagFilterDigest
(
pTagCond
,
&
context
);
bool
acquired
=
false
;
pStorageAPI
->
metaFn
.
getCachedTableList
(
pVnode
,
pScanNode
->
suid
,
context
.
digest
,
tListLen
(
context
.
digest
),
pUidList
,
&
acquired
);
pStorageAPI
->
metaFn
.
getCachedTableList
(
pVnode
,
pScanNode
->
suid
,
context
.
digest
,
tListLen
(
context
.
digest
),
pUidList
,
&
acquired
);
if
(
acquired
)
{
digest
[
0
]
=
1
;
memcpy
(
digest
+
1
,
context
.
digest
,
tListLen
(
context
.
digest
));
...
...
@@ -1097,13 +1100,15 @@ int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, S
if
(
pTagIndexCond
)
{
void
*
pIndex
=
pStorageAPI
->
metaFn
.
getInvertIndex
(
pVnode
);
SIndexMetaArg
metaArg
=
{
.
metaEx
=
pVnode
,
.
idx
=
pStorageAPI
->
metaFn
.
storeGetIndexInfo
(
pVnode
),
.
ivtIdx
=
pIndex
,
.
suid
=
pScanNode
->
uid
};
SIndexMetaArg
metaArg
=
{.
metaEx
=
pVnode
,
.
idx
=
pStorageAPI
->
metaFn
.
storeGetIndexInfo
(
pVnode
),
.
ivtIdx
=
pIndex
,
.
suid
=
pScanNode
->
uid
};
status
=
SFLT_NOT_INDEX
;
code
=
doFilterTag
(
pTagIndexCond
,
&
metaArg
,
pUidList
,
&
status
,
&
pStorageAPI
->
metaFilter
);
if
(
code
!=
0
||
status
==
SFLT_NOT_INDEX
)
{
// temporarily disable it for performance sake
q
Warn
(
"failed to get tableIds from index, suid:%"
PRIu64
,
pScanNode
->
uid
);
q
Info
(
"failed to get tableIds from index, suid:%"
PRIu64
,
pScanNode
->
uid
);
code
=
TSDB_CODE_SUCCESS
;
}
else
{
qInfo
(
"succ to get filter result, table num: %d"
,
(
int
)
taosArrayGetSize
(
pUidList
));
...
...
@@ -1128,7 +1133,8 @@ int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, S
memcpy
(
pPayload
+
sizeof
(
int32_t
),
taosArrayGet
(
pUidList
,
0
),
numOfTables
*
sizeof
(
uint64_t
));
}
// metaUidFilterCachePut(metaHandle, pScanNode->suid, context.digest, tListLen(context.digest), pPayload, size, 1);
// metaUidFilterCachePut(metaHandle, pScanNode->suid, context.digest, tListLen(context.digest), pPayload,
// size, 1);
digest
[
0
]
=
1
;
memcpy
(
digest
+
1
,
context
.
digest
,
tListLen
(
context
.
digest
));
}
...
...
@@ -1152,15 +1158,17 @@ _end:
return
code
;
}
int32_t
qGetTableList
(
int64_t
suid
,
void
*
pVnode
,
void
*
node
,
SArray
**
tableList
,
void
*
pTaskInfo
)
{
SSubplan
*
pSubplan
=
(
SSubplan
*
)
node
;
int32_t
qGetTableList
(
int64_t
suid
,
void
*
pVnode
,
void
*
node
,
SArray
**
tableList
,
void
*
pTaskInfo
)
{
SSubplan
*
pSubplan
=
(
SSubplan
*
)
node
;
SScanPhysiNode
pNode
=
{
0
};
pNode
.
suid
=
suid
;
pNode
.
uid
=
suid
;
pNode
.
tableType
=
TSDB_SUPER_TABLE
;
STableListInfo
*
pTableListInfo
=
tableListCreate
();
uint8_t
digest
[
17
]
=
{
0
};
int
code
=
getTableList
(
pVnode
,
&
pNode
,
pSubplan
?
pSubplan
->
pTagCond
:
NULL
,
pSubplan
?
pSubplan
->
pTagIndexCond
:
NULL
,
pTableListInfo
,
digest
,
"qGetTableList"
,
&
((
SExecTaskInfo
*
)
pTaskInfo
)
->
storageAPI
);
uint8_t
digest
[
17
]
=
{
0
};
int
code
=
getTableList
(
pVnode
,
&
pNode
,
pSubplan
?
pSubplan
->
pTagCond
:
NULL
,
pSubplan
?
pSubplan
->
pTagIndexCond
:
NULL
,
pTableListInfo
,
digest
,
"qGetTableList"
,
&
((
SExecTaskInfo
*
)
pTaskInfo
)
->
storageAPI
);
*
tableList
=
pTableListInfo
->
pTableList
;
pTableListInfo
->
pTableList
=
NULL
;
tableListDestroy
(
pTableListInfo
);
...
...
@@ -1181,7 +1189,7 @@ size_t getTableTagsBufLen(const SNodeList* pGroups) {
}
int32_t
getGroupIdFromTagsVal
(
void
*
pVnode
,
uint64_t
uid
,
SNodeList
*
pGroupNode
,
char
*
keyBuf
,
uint64_t
*
pGroupId
,
SStorageAPI
*
pAPI
)
{
SStorageAPI
*
pAPI
)
{
SMetaReader
mr
=
{
0
};
pAPI
->
metaReaderFn
.
initReader
(
&
mr
,
pVnode
,
0
,
&
pAPI
->
metaFn
);
...
...
@@ -1560,7 +1568,8 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
return
TSDB_CODE_SUCCESS
;
}
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowEntryInfoOffset
,
SFunctionStateStore
*
pStore
)
{
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowEntryInfoOffset
,
SFunctionStateStore
*
pStore
)
{
SqlFunctionCtx
*
pFuncCtx
=
(
SqlFunctionCtx
*
)
taosMemoryCalloc
(
numOfOutput
,
sizeof
(
SqlFunctionCtx
));
if
(
pFuncCtx
==
NULL
)
{
return
NULL
;
...
...
@@ -1849,7 +1858,7 @@ void getNextTimeWindow(const SInterval* pInterval, STimeWindow* tw, int32_t orde
}
struct
tm
tm
;
time_t
t
=
(
time_t
)
key
;
time_t
t
=
(
time_t
)
key
;
taosLocalTime
(
&
t
,
&
tm
,
NULL
);
int
mon
=
(
int
)(
tm
.
tm_year
*
12
+
tm
.
tm_mon
+
duration
*
factor
);
...
...
@@ -2079,8 +2088,8 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
buildGroupIdMapForAllTables
(
STableListInfo
*
pTableListInfo
,
SReadHandle
*
pHandle
,
SScanPhysiNode
*
pScanNode
,
SNodeList
*
group
,
bool
groupSort
,
uint8_t
*
digest
,
SStorageAPI
*
pAPI
)
{
int32_t
buildGroupIdMapForAllTables
(
STableListInfo
*
pTableListInfo
,
SReadHandle
*
pHandle
,
SScanPhysiNode
*
pScanNode
,
SNodeList
*
group
,
bool
groupSort
,
uint8_t
*
digest
,
SStorageAPI
*
pAPI
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
bool
groupByTbname
=
groupbyTbname
(
group
);
...
...
@@ -2132,7 +2141,8 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
}
uint8_t
digest
[
17
]
=
{
0
};
int32_t
code
=
getTableList
(
pHandle
->
vnode
,
pScanNode
,
pTagCond
,
pTagIndexCond
,
pTableListInfo
,
digest
,
idStr
,
&
pTaskInfo
->
storageAPI
);
int32_t
code
=
getTableList
(
pHandle
->
vnode
,
pScanNode
,
pTagCond
,
pTagIndexCond
,
pTableListInfo
,
digest
,
idStr
,
&
pTaskInfo
->
storageAPI
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to getTableList, code: %s"
,
tstrerror
(
code
));
return
code
;
...
...
@@ -2150,7 +2160,8 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
return
TSDB_CODE_SUCCESS
;
}
code
=
buildGroupIdMapForAllTables
(
pTableListInfo
,
pHandle
,
pScanNode
,
pGroupTags
,
groupSort
,
digest
,
&
pTaskInfo
->
storageAPI
);
code
=
buildGroupIdMapForAllTables
(
pTableListInfo
,
pHandle
,
pScanNode
,
pGroupTags
,
groupSort
,
digest
,
&
pTaskInfo
->
storageAPI
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录