Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5772b0bb
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看板
提交
5772b0bb
编写于
7月 09, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): add error code check.
上级
21742bba
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
61 addition
and
21 deletion
+61
-21
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+61
-21
未找到文件。
source/libs/executor/src/scanoperator.c
浏览文件 @
5772b0bb
...
...
@@ -39,8 +39,8 @@ static int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capac
static
int32_t
buildDbTableInfoBlock
(
const
SSDataBlock
*
p
,
const
SSysTableMeta
*
pSysDbTableMeta
,
size_t
size
,
const
char
*
dbName
);
static
void
addTagPseudoColumnData
(
SReadHandle
*
pHandle
,
SExprInfo
*
pPseudoExpr
,
int32_t
numOfPseudoExpr
,
SSDataBlock
*
pBlock
);
static
int32_t
addTagPseudoColumnData
(
SReadHandle
*
pHandle
,
SExprInfo
*
pPseudoExpr
,
int32_t
numOfPseudoExpr
,
SSDataBlock
*
pBlock
,
const
char
*
idStr
);
static
bool
processBlockWithProbability
(
const
SSampleExecInfo
*
pInfo
);
bool
processBlockWithProbability
(
const
SSampleExecInfo
*
pInfo
)
{
...
...
@@ -264,7 +264,11 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
// currently only the tbname pseudo column
if
(
pTableScanInfo
->
pseudoSup
.
numOfExprs
>
0
)
{
SExprSupp
*
pSup
=
&
pTableScanInfo
->
pseudoSup
;
addTagPseudoColumnData
(
&
pTableScanInfo
->
readHandle
,
pSup
->
pExprInfo
,
pSup
->
numOfExprs
,
pBlock
);
int32_t
code
=
addTagPseudoColumnData
(
&
pTableScanInfo
->
readHandle
,
pSup
->
pExprInfo
,
pSup
->
numOfExprs
,
pBlock
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pTaskInfo
->
env
,
code
);
}
}
int64_t
st
=
taosGetTimestampMs
();
...
...
@@ -298,16 +302,21 @@ static void prepareForDescendingScan(STableScanInfo* pTableScanInfo, SqlFunction
taosqsort
(
pCond
->
twindows
,
pCond
->
numOfTWindows
,
sizeof
(
STimeWindow
),
pCond
,
compareTimeWindow
);
}
void
addTagPseudoColumnData
(
SReadHandle
*
pHandle
,
SExprInfo
*
pPseudoExpr
,
int32_t
numOfPseudoExpr
,
SSDataBlock
*
pBlock
)
{
int32_t
addTagPseudoColumnData
(
SReadHandle
*
pHandle
,
SExprInfo
*
pPseudoExpr
,
int32_t
numOfPseudoExpr
,
SSDataBlock
*
pBlock
,
const
char
*
idStr
)
{
// currently only the tbname pseudo column
if
(
numOfPseudoExpr
==
0
)
{
return
;
return
TSDB_CODE_SUCCESS
;
}
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
metaGetTableEntryByUid
(
&
mr
,
pBlock
->
info
.
uid
);
int32_t
code
=
metaGetTableEntryByUid
(
&
mr
,
pBlock
->
info
.
uid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to get table meta, uid:0x%"
PRIx64
", code:%s, %s"
,
pBlock
->
info
.
uid
,
tstrerror
(
terrno
),
idStr
);
metaReaderClear
(
&
mr
);
return
terrno
;
}
for
(
int32_t
j
=
0
;
j
<
numOfPseudoExpr
;
++
j
)
{
SExprInfo
*
pExpr
=
&
pPseudoExpr
[
j
];
...
...
@@ -349,6 +358,7 @@ void addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_
}
metaReaderClear
(
&
mr
);
return
TSDB_CODE_SUCCESS
;
}
void
setTbNameColData
(
void
*
pMeta
,
const
SSDataBlock
*
pBlock
,
SColumnInfoData
*
pColInfoData
,
int32_t
functionId
)
{
...
...
@@ -680,34 +690,46 @@ SOperatorInfo* createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo*
return
pOperator
;
}
static
int32_t
doGetTableRowSize
(
void
*
pMeta
,
uint64_t
uid
)
{
int32_t
rowLen
=
0
;
static
int32_t
doGetTableRowSize
(
void
*
pMeta
,
uint64_t
uid
,
int32_t
*
rowLen
,
const
char
*
idstr
)
{
*
rowLen
=
0
;
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pMeta
,
0
);
metaGetTableEntryByUid
(
&
mr
,
uid
);
int32_t
code
=
metaGetTableEntryByUid
(
&
mr
,
uid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to get table meta, uid:0x%"
PRIx64
", code:%s, %s"
,
uid
,
tstrerror
(
terrno
),
idstr
);
metaReaderClear
(
&
mr
);
return
terrno
;
}
if
(
mr
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
int32_t
numOfCols
=
mr
.
me
.
stbEntry
.
schemaRow
.
nCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
rowLen
+=
mr
.
me
.
stbEntry
.
schemaRow
.
pSchema
[
i
].
bytes
;
(
*
rowLen
)
+=
mr
.
me
.
stbEntry
.
schemaRow
.
pSchema
[
i
].
bytes
;
}
}
else
if
(
mr
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
uint64_t
suid
=
mr
.
me
.
ctbEntry
.
suid
;
metaGetTableEntryByUid
(
&
mr
,
suid
);
code
=
metaGetTableEntryByUid
(
&
mr
,
suid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to get table meta, uid:0x%"
PRIx64
", code:%s, %s"
,
suid
,
tstrerror
(
terrno
),
idstr
);
metaReaderClear
(
&
mr
);
return
terrno
;
}
int32_t
numOfCols
=
mr
.
me
.
stbEntry
.
schemaRow
.
nCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
rowLen
+=
mr
.
me
.
stbEntry
.
schemaRow
.
pSchema
[
i
].
bytes
;
(
*
rowLen
)
+=
mr
.
me
.
stbEntry
.
schemaRow
.
pSchema
[
i
].
bytes
;
}
}
else
if
(
mr
.
me
.
type
==
TSDB_NORMAL_TABLE
)
{
int32_t
numOfCols
=
mr
.
me
.
ntbEntry
.
schemaRow
.
nCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
rowLen
+=
mr
.
me
.
ntbEntry
.
schemaRow
.
pSchema
[
i
].
bytes
;
(
*
rowLen
)
+=
mr
.
me
.
ntbEntry
.
schemaRow
.
pSchema
[
i
].
bytes
;
}
}
metaReaderClear
(
&
mr
);
return
rowLen
;
return
TSDB_CODE_SUCCESS
;
}
static
SSDataBlock
*
doBlockInfoScan
(
SOperatorInfo
*
pOperator
)
{
...
...
@@ -716,9 +738,13 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator) {
}
SBlockDistInfo
*
pBlockScanInfo
=
pOperator
->
info
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
STableBlockDistInfo
blockDistInfo
=
{.
minRows
=
INT_MAX
,
.
maxRows
=
INT_MIN
};
blockDistInfo
.
rowSize
=
doGetTableRowSize
(
pBlockScanInfo
->
readHandle
.
meta
,
pBlockScanInfo
->
uid
);
int32_t
code
=
doGetTableRowSize
(
pBlockScanInfo
->
readHandle
.
meta
,
pBlockScanInfo
->
uid
,
&
blockDistInfo
.
rowSize
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pTaskInfo
->
env
,
code
);
}
tsdbGetFileBlocksDistInfo
(
pBlockScanInfo
->
pHandle
,
&
blockDistInfo
);
blockDistInfo
.
numOfInmemRows
=
(
int32_t
)
tsdbGetNumOfRowsInMemTable
(
pBlockScanInfo
->
pHandle
);
...
...
@@ -1193,7 +1219,10 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
// currently only the tbname pseudo column
if
(
pInfo
->
numOfPseudoExpr
>
0
)
{
addTagPseudoColumnData
(
&
pInfo
->
readHandle
,
pInfo
->
pPseudoExpr
,
pInfo
->
numOfPseudoExpr
,
pInfo
->
pRes
);
int32_t
code
=
addTagPseudoColumnData
(
&
pInfo
->
readHandle
,
pInfo
->
pPseudoExpr
,
pInfo
->
numOfPseudoExpr
,
pInfo
->
pRes
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pTaskInfo
->
env
,
code
);
}
}
doFilter
(
pInfo
->
pCondition
,
pInfo
->
pRes
);
...
...
@@ -1414,7 +1443,10 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
// currently only the tbname pseudo column
if
(
pInfo
->
numOfPseudoExpr
>
0
)
{
addTagPseudoColumnData
(
&
pInfo
->
readHandle
,
pInfo
->
pPseudoExpr
,
pInfo
->
numOfPseudoExpr
,
pInfo
->
pRes
);
code
=
addTagPseudoColumnData
(
&
pInfo
->
readHandle
,
pInfo
->
pPseudoExpr
,
pInfo
->
numOfPseudoExpr
,
pInfo
->
pRes
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pTaskInfo
->
env
,
code
);
}
}
doFilter
(
pInfo
->
pCondition
,
pInfo
->
pRes
);
...
...
@@ -2243,7 +2275,12 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
while
(
pInfo
->
curPos
<
size
&&
count
<
pOperator
->
resultInfo
.
capacity
)
{
STableKeyInfo
*
item
=
taosArrayGet
(
pInfo
->
pTableList
->
pTableList
,
pInfo
->
curPos
);
metaGetTableEntryByUid
(
&
mr
,
item
->
uid
);
int32_t
code
=
metaGetTableEntryByUid
(
&
mr
,
item
->
uid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to get table meta, uid:0x%"
PRIx64
", code:%s, %s"
,
item
->
uid
,
tstrerror
(
terrno
),
GET_TASKID
(
pTaskInfo
));
metaReaderClear
(
&
mr
);
longjmp
(
pTaskInfo
->
env
,
terrno
);
}
for
(
int32_t
j
=
0
;
j
<
pOperator
->
exprSupp
.
numOfExprs
;
++
j
)
{
SColumnInfoData
*
pDst
=
taosArrayGet
(
pRes
->
pDataBlock
,
pExprInfo
[
j
].
base
.
resSchema
.
slotId
);
...
...
@@ -2528,8 +2565,11 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
// currently only the tbname pseudo column
if
(
pTableScanInfo
->
numOfPseudoExpr
>
0
)
{
addTagPseudoColumnData
(
&
pTableScanInfo
->
readHandle
,
pTableScanInfo
->
pPseudoExpr
,
pTableScanInfo
->
numOfPseudoExpr
,
pBlock
);
int32_t
code
=
addTagPseudoColumnData
(
&
pTableScanInfo
->
readHandle
,
pTableScanInfo
->
pPseudoExpr
,
pTableScanInfo
->
numOfPseudoExpr
,
pBlock
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pTaskInfo
->
env
,
code
);
}
}
int64_t
st
=
taosGetTimestampMs
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录