Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3a566d5e
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看板
提交
3a566d5e
编写于
6月 29, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(query): do some internal refactor.
上级
7678b6bb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
21 deletion
+30
-21
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+20
-12
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+1
-1
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+3
-3
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+4
-4
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-1
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+1
-0
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
3a566d5e
...
...
@@ -984,8 +984,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
}
}
else
{
SColVal
cv
=
{
0
};
SColData
*
pData
=
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
pReader
->
suppInfo
.
slotIds
[
i
]);
SColData
*
pData
=
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
pReader
->
suppInfo
.
slotIds
[
i
]
-
1
);
for
(
int32_t
j
=
0
;
j
<
pBlockData
->
nRow
;
++
j
)
{
tColDataGetValue
(
pData
,
j
,
&
cv
);
colDataAppend
(
pColData
,
j
,
(
const
char
*
)
&
cv
.
value
,
cv
.
isNull
);
...
...
@@ -994,7 +993,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
}
pReader
->
pResBlock
->
info
.
rows
=
pBlockData
->
nRow
;
setBlockDumpCompleted
(
&
pReader
->
status
.
fBlockDumpInfo
,
pBlockData
);
setBlockDumpCompleted
(
&
pReader
->
status
.
fBlockDumpInfo
,
pBlockData
);
/*
int32_t ret = tsdbLoadBlockDataCols(&(pReader->rhelper), pBlock, pCheckInfo->pCompInfo, colIds,
...
...
@@ -2283,7 +2282,7 @@ static bool bufferDataInFileBlockGap(int32_t order, TSDBKEY key, SBlock* pBlock)
}
static
bool
keyOverlapFileBlock
(
TSDBKEY
key
,
SBlock
*
pBlock
,
SVersionRange
*
pVerRange
)
{
return
(
key
.
ts
>=
pBlock
->
minKey
.
ts
&&
key
.
ts
<=
pBlock
->
maxKey
.
ts
)
/*&& (pBlock->maxVersion >= pVerRange->minVer) && (pBlock->minVersion <= pVerRange->maxVer)*/
;
return
(
key
.
ts
>=
pBlock
->
minKey
.
ts
&&
key
.
ts
<=
pBlock
->
maxKey
.
ts
)
&&
(
pBlock
->
maxVersion
>=
pVerRange
->
minVer
)
&&
(
pBlock
->
minVersion
<=
pVerRange
->
maxVer
)
;
}
static
bool
fileBlockShouldLoad
(
STsdbReader
*
pReader
,
SFileDataBlockInfo
*
pFBlock
,
SBlock
*
pBlock
,
STableBlockScanInfo
*
pScanInfo
,
TSDBKEY
key
)
{
...
...
@@ -2616,7 +2615,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
return
code
;
}
static
int32_t
build
InmemBlock
Seqentially
(
STsdbReader
*
pReader
)
{
static
int32_t
build
BlockFromBuffer
Seqentially
(
STsdbReader
*
pReader
)
{
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
while
(
1
)
{
...
...
@@ -2644,7 +2643,7 @@ static int32_t buildInmemBlockSeqentially(STsdbReader* pReader) {
}
}
static
int32_t
loadDataIn
Files
(
STsdbReader
*
pReader
)
{
static
int32_t
buildBlockFrom
Files
(
STsdbReader
*
pReader
)
{
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
SFileSetIter
*
pFIter
=
&
pStatus
->
fileIter
;
...
...
@@ -3018,7 +3017,7 @@ int32_t tsdbGetStbIdList(SMeta* pMeta, int64_t suid, SArray* list) {
// // check if the query range overlaps with the file data block
// bool exists = true;
// int32_t code =
loadDataIn
Files(pTsdbReadHandle, &exists);
// int32_t code =
buildBlockFrom
Files(pTsdbReadHandle, &exists);
// if (code != TSDB_CODE_SUCCESS) {
// pTsdbReadHandle->checkFiles = false;
// return false;
...
...
@@ -3306,7 +3305,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
if
(
pReader
->
type
==
BLOCK_LOAD_OFFSET_ORDER
)
{
if
(
pStatus
->
loadFromFile
)
{
int32_t
code
=
loadDataIn
Files
(
pReader
);
int32_t
code
=
buildBlockFrom
Files
(
pReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
false
;
}
...
...
@@ -3314,11 +3313,11 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
if
(
pBlock
->
info
.
rows
>
0
)
{
return
true
;
}
else
{
build
InmemBlock
Seqentially
(
pReader
);
build
BlockFromBuffer
Seqentially
(
pReader
);
return
pBlock
->
info
.
rows
>
0
;
}
}
else
{
// no data in files, let's try the buffer
build
InmemBlock
Seqentially
(
pReader
);
build
BlockFromBuffer
Seqentially
(
pReader
);
return
pBlock
->
info
.
rows
>
0
;
}
}
else
if
(
pReader
->
type
==
BLOCK_LOAD_TABLESEQ_ORDER
)
{
...
...
@@ -3334,7 +3333,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
// if (pReader->checkFiles) {
// // check if the query range overlaps with the file data block
// bool exists = true;
// int32_t code =
loadDataIn
Files(pReader, &exists);
// int32_t code =
buildBlockFrom
Files(pReader, &exists);
// if (code != TSDB_CODE_SUCCESS) {
// pReader->activeIndex = 0;
// pReader->checkFiles = false;
...
...
@@ -3454,7 +3453,16 @@ SArray* tsdbRetrieveDataBlock(STsdbReader* pReader, SArray* pIdList) {
STableBlockScanInfo
*
pBlockScanInfo
=
taosHashGet
(
pStatus
->
pTableMap
,
&
pFBlock
->
uid
,
sizeof
(
pFBlock
->
uid
));
int32_t
code
=
tBlockDataInit
(
&
pStatus
->
fileBlockData
);
doLoadFileBlockData
(
pReader
,
&
pStatus
->
blockIter
,
pBlockScanInfo
,
&
pStatus
->
fileBlockData
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
return
NULL
;
}
code
=
doLoadFileBlockData
(
pReader
,
&
pStatus
->
blockIter
,
pBlockScanInfo
,
&
pStatus
->
fileBlockData
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
return
NULL
;
}
return
pReader
->
pResBlock
->
pDataBlock
;
}
...
...
source/libs/executor/inc/executil.h
浏览文件 @
3a566d5e
...
...
@@ -107,7 +107,7 @@ int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo);
SSDataBlock
*
createResDataBlock
(
SDataBlockDescNode
*
pNode
);
EDealRes
doTranslateTagExpr
(
SNode
**
pNode
,
void
*
pContext
);
int32_t
getTableList
(
void
*
metaHandle
,
SScanPhysiNode
*
pScanNode
,
STableListInfo
*
pListInfo
);
int32_t
getTableList
(
void
*
metaHandle
,
void
*
vnode
,
SScanPhysiNode
*
pScanNode
,
STableListInfo
*
pListInfo
);
SArray
*
createSortInfo
(
SNodeList
*
pNodeList
);
SArray
*
extractPartitionColInfo
(
SNodeList
*
pNodeList
);
SArray
*
extractColMatchInfo
(
SNodeList
*
pNodeList
,
SDataBlockDescNode
*
pOutputNodeList
,
int32_t
*
numOfOutputCols
,
int32_t
type
);
...
...
source/libs/executor/src/executil.c
浏览文件 @
3a566d5e
...
...
@@ -283,7 +283,7 @@ static bool isTableOk(STableKeyInfo* info, SNode *pTagCond, SMeta *metaHandle){
return
result
;
}
int32_t
getTableList
(
void
*
metaHandle
,
SScanPhysiNode
*
pScanNode
,
STableListInfo
*
pListInfo
)
{
int32_t
getTableList
(
void
*
metaHandle
,
void
*
pVnode
,
SScanPhysiNode
*
pScanNode
,
STableListInfo
*
pListInfo
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
pListInfo
->
pTableList
=
taosArrayInit
(
8
,
sizeof
(
STableKeyInfo
));
if
(
pListInfo
->
pTableList
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -303,7 +303,7 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
//code = doFilterTag(pTagIndexCond, &metaArg, res);
code
=
TSDB_CODE_INDEX_REBUILDING
;
if
(
code
==
TSDB_CODE_INDEX_REBUILDING
)
{
code
=
vnodeGetAllTableList
(
metaHandl
e
,
tableUid
,
pListInfo
->
pTableList
);
code
=
vnodeGetAllTableList
(
pVnod
e
,
tableUid
,
pListInfo
->
pTableList
);
}
else
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to get tableIds, reason: %s, suid: %"
PRIu64
""
,
tstrerror
(
code
),
tableUid
);
taosArrayDestroy
(
res
);
...
...
@@ -319,7 +319,7 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
}
taosArrayDestroy
(
res
);
}
else
{
code
=
vnodeGetAllTableList
(
metaHandl
e
,
tableUid
,
pListInfo
->
pTableList
);
code
=
vnodeGetAllTableList
(
pVnod
e
,
tableUid
,
pListInfo
->
pTableList
);
}
if
(
pTagCond
){
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
3a566d5e
...
...
@@ -4121,7 +4121,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
==
type
)
{
STagScanPhysiNode
*
pScanPhyNode
=
(
STagScanPhysiNode
*
)
pPhyNode
;
int32_t
code
=
getTableList
(
pHandle
->
meta
,
pScanPhyNode
,
pTableListInfo
);
int32_t
code
=
getTableList
(
pHandle
->
meta
,
p
Handle
->
vnode
,
p
ScanPhyNode
,
pTableListInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pTaskInfo
->
code
=
terrno
;
return
NULL
;
...
...
@@ -4133,7 +4133,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pTableListInfo
->
pTableList
=
taosArrayInit
(
4
,
sizeof
(
STableKeyInfo
));
if
(
pBlockNode
->
tableType
==
TSDB_SUPER_TABLE
)
{
int32_t
code
=
vnodeGetAllTableList
(
pHandle
->
meta
,
pBlockNode
->
uid
,
pTableListInfo
->
pTableList
);
int32_t
code
=
vnodeGetAllTableList
(
pHandle
->
vnode
,
pBlockNode
->
uid
,
pTableListInfo
->
pTableList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pTaskInfo
->
code
=
terrno
;
return
NULL
;
...
...
@@ -4183,7 +4183,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pTableListInfo
->
pTableList
=
taosArrayInit
(
4
,
sizeof
(
STableKeyInfo
));
if
(
pScanNode
->
tableType
==
TSDB_SUPER_TABLE
)
{
code
=
vnodeGetAllTableList
(
pHandle
->
meta
,
pScanNode
->
uid
,
pTableListInfo
->
pTableList
);
code
=
vnodeGetAllTableList
(
pHandle
->
vnode
,
pScanNode
->
uid
,
pTableListInfo
->
pTableList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pTaskInfo
->
code
=
terrno
;
return
NULL
;
...
...
@@ -4399,7 +4399,7 @@ SArray* extractColumnInfo(SNodeList* pNodeList) {
}
STsdbReader
*
doCreateDataReader
(
STableScanPhysiNode
*
pTableScanNode
,
SReadHandle
*
pHandle
,
STableListInfo
*
pTableListInfo
,
const
char
*
idstr
)
{
int32_t
code
=
getTableList
(
pHandle
->
meta
,
&
pTableScanNode
->
scan
,
pTableListInfo
);
int32_t
code
=
getTableList
(
pHandle
->
meta
,
pHandle
->
vnode
,
&
pTableScanNode
->
scan
,
pTableListInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
3a566d5e
...
...
@@ -2033,7 +2033,7 @@ typedef struct STableMergeScanInfo {
int32_t
createScanTableListInfo
(
STableScanPhysiNode
*
pTableScanNode
,
SReadHandle
*
pHandle
,
STableListInfo
*
pTableListInfo
,
uint64_t
queryId
,
uint64_t
taskId
)
{
int32_t
code
=
getTableList
(
pHandle
->
meta
,
&
pTableScanNode
->
scan
,
pTableListInfo
);
int32_t
code
=
getTableList
(
pHandle
->
meta
,
pHandle
->
vnode
,
&
pTableScanNode
->
scan
,
pTableListInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
source/libs/executor/src/tsort.c
浏览文件 @
3a566d5e
...
...
@@ -545,6 +545,7 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
return
0
;
}
// TODO consider the page meta size
int32_t
getProperSortPageSize
(
size_t
rowSize
)
{
uint32_t
defaultPageSize
=
4096
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录