Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1cdde411
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看板
未验证
提交
1cdde411
编写于
7月 21, 2022
作者:
M
Minglei Jin
提交者:
GitHub
7月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15227 from taosdata/fix/TD-17582-v2
fix: error case handle when table was dropped
上级
dae00fd1
35962276
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
22 deletion
+28
-22
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+28
-22
未找到文件。
source/libs/executor/src/executil.c
浏览文件 @
1cdde411
...
...
@@ -13,7 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ttime.h"
#include "function.h"
#include "functionMgt.h"
#include "index.h"
...
...
@@ -21,6 +20,7 @@
#include "tdatablock.h"
#include "thash.h"
#include "tmsg.h"
#include "ttime.h"
#include "executil.h"
#include "executorimpl.h"
...
...
@@ -72,7 +72,7 @@ size_t getResultRowSize(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
void
cleanupGroupResInfo
(
SGroupResInfo
*
pGroupResInfo
)
{
assert
(
pGroupResInfo
!=
NULL
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pGroupResInfo
->
pRows
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pGroupResInfo
->
pRows
);
++
i
)
{
SResKeyPos
*
pRes
=
taosArrayGetP
(
pGroupResInfo
->
pRows
,
i
);
taosMemoryFree
(
pRes
);
}
...
...
@@ -266,17 +266,24 @@ EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) {
}
int32_t
isTableOk
(
STableKeyInfo
*
info
,
SNode
*
pTagCond
,
void
*
metaHandle
,
bool
*
pQualified
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
metaHandle
,
0
);
metaGetTableEntryByUid
(
&
mr
,
info
->
uid
);
code
=
metaGetTableEntryByUid
(
&
mr
,
info
->
uid
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
metaReaderClear
(
&
mr
);
return
terrno
;
}
SNode
*
pTagCondTmp
=
nodesCloneNode
(
pTagCond
);
nodesRewriteExprPostOrder
(
&
pTagCondTmp
,
doTranslateTagExpr
,
&
mr
);
metaReaderClear
(
&
mr
);
SNode
*
pNew
=
NULL
;
int32_t
code
=
scalarCalculateConstants
(
pTagCondTmp
,
&
pNew
);
SNode
*
pNew
=
NULL
;
code
=
scalarCalculateConstants
(
pTagCondTmp
,
&
pNew
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
terrno
=
code
;
nodesDestroyNode
(
pTagCondTmp
);
...
...
@@ -295,7 +302,8 @@ int32_t isTableOk(STableKeyInfo* info, SNode* pTagCond, void* metaHandle, bool*
return
TSDB_CODE_SUCCESS
;
}
int32_t
getTableList
(
void
*
metaHandle
,
void
*
pVnode
,
SScanPhysiNode
*
pScanNode
,
SNode
*
pTagCond
,
SNode
*
pTagIndexCond
,
STableListInfo
*
pListInfo
)
{
int32_t
getTableList
(
void
*
metaHandle
,
void
*
pVnode
,
SScanPhysiNode
*
pScanNode
,
SNode
*
pTagCond
,
SNode
*
pTagIndexCond
,
STableListInfo
*
pListInfo
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
pListInfo
->
pTableList
=
taosArrayInit
(
8
,
sizeof
(
STableKeyInfo
));
...
...
@@ -317,7 +325,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
code
=
doFilterTag
(
pTagIndexCond
,
&
metaArg
,
res
,
&
status
);
if
(
code
!=
0
||
status
==
SFLT_NOT_INDEX
)
{
qError
(
"failed to get tableIds from index, reason:%s, suid:%"
PRIu64
,
tstrerror
(
code
),
tableUid
);
// code = TSDB_CODE_INDEX_REBUILDING;
// code = TSDB_CODE_INDEX_REBUILDING;
code
=
vnodeGetAllTableList
(
pVnode
,
tableUid
,
pListInfo
->
pTableList
);
}
else
{
qDebug
(
"success to get tableIds, size:%d, suid:%"
PRIu64
,
(
int
)
taosArrayGetSize
(
res
),
tableUid
);
...
...
@@ -610,8 +618,7 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
const
char
*
pName
=
pCtx
[
i
].
pExpr
->
pExpr
->
_function
.
functionName
;
if
((
strcmp
(
pName
,
"_select_value"
)
==
0
)
||
(
strcmp
(
pName
,
"_group_key"
)
==
0
))
{
if
((
strcmp
(
pName
,
"_select_value"
)
==
0
)
||
(
strcmp
(
pName
,
"_group_key"
)
==
0
))
{
pValCtx
[
num
++
]
=
&
pCtx
[
i
];
}
else
if
(
fmIsSelectFunc
(
pCtx
[
i
].
functionId
))
{
p
=
&
pCtx
[
i
];
...
...
@@ -747,11 +754,11 @@ SInterval extractIntervalInfo(const STableScanPhysiNode* pTableScanNode) {
SColumn
extractColumnFromColumnNode
(
SColumnNode
*
pColNode
)
{
SColumn
c
=
{
0
};
c
.
slotId
=
pColNode
->
slotId
;
c
.
colId
=
pColNode
->
colId
;
c
.
type
=
pColNode
->
node
.
resType
.
type
;
c
.
bytes
=
pColNode
->
node
.
resType
.
bytes
;
c
.
scale
=
pColNode
->
node
.
resType
.
scale
;
c
.
slotId
=
pColNode
->
slotId
;
c
.
colId
=
pColNode
->
colId
;
c
.
type
=
pColNode
->
node
.
resType
.
type
;
c
.
bytes
=
pColNode
->
node
.
resType
.
bytes
;
c
.
scale
=
pColNode
->
node
.
resType
.
scale
;
c
.
precision
=
pColNode
->
node
.
resType
.
precision
;
return
c
;
}
...
...
@@ -768,10 +775,10 @@ int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysi
// pCond->twindow = pTableScanNode->scanRange;
// TODO: get it from stable scan node
pCond
->
twindows
=
pTableScanNode
->
scanRange
;
pCond
->
suid
=
pTableScanNode
->
scan
.
suid
;
pCond
->
type
=
BLOCK_LOAD_OFFSET_ORDER
;
pCond
->
suid
=
pTableScanNode
->
scan
.
suid
;
pCond
->
type
=
BLOCK_LOAD_OFFSET_ORDER
;
pCond
->
startVersion
=
-
1
;
pCond
->
endVersion
=
-
1
;
pCond
->
endVersion
=
-
1
;
// pCond->type = pTableScanNode->scanFlag;
int32_t
j
=
0
;
...
...
@@ -850,11 +857,11 @@ static STimeWindow doCalculateTimeWindow(int64_t ts, SInterval* pInterval) {
}
STimeWindow
getFirstQualifiedTimeWindow
(
int64_t
ts
,
STimeWindow
*
pWindow
,
SInterval
*
pInterval
,
int32_t
order
)
{
int32_t
factor
=
(
order
==
TSDB_ORDER_ASC
)
?
-
1
:
1
;
int32_t
factor
=
(
order
==
TSDB_ORDER_ASC
)
?
-
1
:
1
;
STimeWindow
win
=
*
pWindow
;
STimeWindow
save
=
win
;
while
(
win
.
skey
<=
ts
&&
win
.
ekey
>=
ts
)
{
while
(
win
.
skey
<=
ts
&&
win
.
ekey
>=
ts
)
{
save
=
win
;
win
.
skey
=
taosTimeAdd
(
win
.
skey
,
factor
*
pInterval
->
sliding
,
pInterval
->
slidingUnit
,
pInterval
->
precision
);
win
.
ekey
=
taosTimeAdd
(
win
.
ekey
,
factor
*
pInterval
->
sliding
,
pInterval
->
slidingUnit
,
pInterval
->
precision
);
...
...
@@ -894,7 +901,6 @@ bool hasLimitOffsetInfo(SLimitInfo* pLimitInfo) {
pLimitInfo
->
slimit
.
offset
!=
-
1
);
}
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
;
}
...
...
@@ -903,7 +909,7 @@ void initLimitInfo(const SNode* pLimit, const SNode* pSLimit, SLimitInfo* pLimit
SLimit
slimit
=
{.
limit
=
getLimit
(
pSLimit
),
.
offset
=
getOffset
(
pSLimit
)};
pLimitInfo
->
limit
=
limit
;
pLimitInfo
->
slimit
=
slimit
;
pLimitInfo
->
slimit
=
slimit
;
pLimitInfo
->
remainOffset
=
limit
.
offset
;
pLimitInfo
->
remainGroupOffset
=
slimit
.
offset
;
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录