Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
c1bea666
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c1bea666
编写于
10月 24, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1373]
上级
c6cc433c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
41 deletion
+53
-41
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+14
-22
src/common/src/tvariant.c
src/common/src/tvariant.c
+4
-9
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+35
-10
未找到文件。
src/client/src/tscSubquery.c
浏览文件 @
c1bea666
...
...
@@ -979,27 +979,12 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR
tscBuildResFromSubqueries
(
pParentSql
);
}
static
SJoinSupporter
*
tscUpdateSubqueryStatus
(
SSqlObj
*
pSql
,
int32_t
numOfFetch
)
{
int32_t
notInvolved
=
0
;
SSubqueryState
*
pState
=
&
pSql
->
subState
;
for
(
int32_t
i
=
0
;
i
<
pSql
->
subState
.
numOfSub
;
++
i
)
{
if
(
pSql
->
pSubs
[
i
]
==
NULL
)
{
notInvolved
++
;
// } else {
// (SJoinSupporter*)pSql->pSubs[i]->param;
}
}
pState
->
numOfRemain
=
numOfFetch
;
return
NULL
;
}
void
tscFetchDatablockFromSubquery
(
SSqlObj
*
pSql
)
{
assert
(
pSql
->
subState
.
numOfSub
>=
1
);
int32_t
numOfFetch
=
0
;
bool
hasData
=
true
;
bool
hasData
=
true
;
bool
reachLimit
=
false
;
// if the subquery is NULL, it does not involved in the final result generation
for
(
int32_t
i
=
0
;
i
<
pSql
->
subState
.
numOfSub
;
++
i
)
{
...
...
@@ -1025,7 +1010,8 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
}
}
else
{
// has reach the limitation, no data anymore
if
(
pRes
->
row
>=
pRes
->
numOfRows
)
{
hasData
=
false
;
reachLimit
=
true
;
hasData
=
false
;
break
;
}
}
...
...
@@ -1039,7 +1025,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
// If at least one subquery is completed in current vnode, try the next vnode in case of multi-vnode
// super table projection query.
if
(
numOfFetch
<=
0
)
{
if
(
numOfFetch
<=
0
&&
!
reachLimit
)
{
bool
tryNextVnode
=
false
;
SSqlObj
*
pp
=
pSql
->
pSubs
[
0
];
...
...
@@ -1109,8 +1095,8 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
// retrieve data from current vnode.
tscDebug
(
"%p retrieve data from %d subqueries"
,
pSql
,
numOfFetch
);
SJoinSupporter
*
pSupporter
=
NULL
;
tscUpdateSubqueryStatus
(
pSql
,
numOfFetch
)
;
pSql
->
subState
.
numOfRemain
=
numOfFetch
;
for
(
int32_t
i
=
0
;
i
<
pSql
->
subState
.
numOfSub
;
++
i
)
{
SSqlObj
*
pSql1
=
pSql
->
pSubs
[
i
];
if
(
pSql1
==
NULL
)
{
...
...
@@ -1522,7 +1508,13 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
SSubqueryState
*
pState
=
&
pSql
->
subState
;
pState
->
numOfSub
=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
;
pState
->
numOfSub
=
0
;
if
(
pTableMetaInfo
->
pVgroupTables
==
NULL
)
{
pState
->
numOfSub
=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
;
}
else
{
pState
->
numOfSub
=
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);
}
assert
(
pState
->
numOfSub
>
0
);
int32_t
ret
=
tscLocalReducerEnvCreate
(
pSql
,
&
pMemoryBuf
,
&
pDesc
,
&
pModel
,
nBufferSize
);
...
...
src/common/src/tvariant.c
浏览文件 @
c1bea666
...
...
@@ -145,8 +145,9 @@ void tVariantAssign(tVariant *pDst, const tVariant *pSrc) {
if
(
pSrc
==
NULL
||
pDst
==
NULL
)
return
;
pDst
->
nType
=
pSrc
->
nType
;
if
(
pSrc
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pSrc
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pSrc
->
nType
>=
TSDB_DATA_TYPE_BOOL
&&
pSrc
->
nType
<=
TSDB_DATA_TYPE_DOUBLE
)
{
pDst
->
i64Key
=
pSrc
->
i64Key
;
}
else
if
(
pSrc
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pSrc
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
int32_t
len
=
pSrc
->
nLen
+
TSDB_NCHAR_SIZE
;
char
*
p
=
realloc
(
pDst
->
pz
,
len
);
assert
(
p
);
...
...
@@ -156,11 +157,7 @@ void tVariantAssign(tVariant *pDst, const tVariant *pSrc) {
memcpy
(
pDst
->
pz
,
pSrc
->
pz
,
pSrc
->
nLen
);
pDst
->
nLen
=
pSrc
->
nLen
;
return
;
}
// this is only for string array
if
(
pSrc
->
nType
==
TSDB_DATA_TYPE_ARRAY
)
{
}
else
if
(
pSrc
->
nType
==
TSDB_DATA_TYPE_ARRAY
)
{
// this is only for string array
size_t
num
=
taosArrayGetSize
(
pSrc
->
arr
);
pDst
->
arr
=
taosArrayInit
(
num
,
sizeof
(
char
*
));
for
(
size_t
i
=
0
;
i
<
num
;
i
++
)
{
...
...
@@ -168,8 +165,6 @@ void tVariantAssign(tVariant *pDst, const tVariant *pSrc) {
char
*
n
=
strdup
(
p
);
taosArrayPush
(
pDst
->
arr
,
&
n
);
}
return
;
}
pDst
->
nLen
=
tDataTypeDesc
[
pDst
->
nType
].
nSize
;
...
...
src/query/src/qExecutor.c
浏览文件 @
c1bea666
...
...
@@ -4767,36 +4767,61 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) {
}
if
(
pRuntimeEnv
->
pTSBuf
!=
NULL
)
{
tVariant
*
pTag
=
&
pRuntimeEnv
->
pCtx
[
0
].
tag
;
if
(
pRuntimeEnv
->
cur
.
vgroupIndex
==
-
1
)
{
STSElem
elem
=
tsBufGetElemStartPos
(
pRuntimeEnv
->
pTSBuf
,
pQInfo
->
vgId
,
&
pRuntimeEnv
->
pCtx
[
0
].
t
ag
);
STSElem
elem
=
tsBufGetElemStartPos
(
pRuntimeEnv
->
pTSBuf
,
pQInfo
->
vgId
,
pT
ag
);
// failed to find data with the specified tag value and vnodeId
if
(
elem
.
vnode
<
0
)
{
qError
(
"QInfo:%p failed to find tag:%s in ts_comp"
,
pQInfo
,
pRuntimeEnv
->
pCtx
[
0
].
tag
.
pz
);
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
qError
(
"QInfo:%p failed to find tag:%s in ts_comp"
,
pQInfo
,
pTag
->
pz
);
}
else
{
qError
(
"QInfo:%p failed to find tag:%"
PRId64
" in ts_comp"
,
pQInfo
,
pTag
->
i64Key
);
}
return
false
;
}
else
{
STSCursor
cur
=
tsBufGetCursor
(
pRuntimeEnv
->
pTSBuf
);
qDebug
(
"QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
pQInfo
,
pRuntimeEnv
->
pCtx
[
0
].
tag
.
pz
,
cur
.
blockIndex
,
cur
.
tsIndex
);
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
qDebug
(
"QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
pQInfo
,
pTag
->
pz
,
cur
.
blockIndex
,
cur
.
tsIndex
);
}
else
{
qDebug
(
"QInfo:%p find tag:%"
PRId64
" start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
pQInfo
,
pTag
->
i64Key
,
cur
.
blockIndex
,
cur
.
tsIndex
);
}
}
}
else
{
STSElem
elem
=
tsBufGetElem
(
pRuntimeEnv
->
pTSBuf
);
if
(
tVariantCompare
(
&
elem
.
tag
,
&
pRuntimeEnv
->
pCtx
[
0
].
tag
)
!=
0
)
{
STSElem
elem1
=
tsBufGetElemStartPos
(
pRuntimeEnv
->
pTSBuf
,
pQInfo
->
vgId
,
&
pRuntimeEnv
->
pCtx
[
0
].
t
ag
);
STSElem
elem1
=
tsBufGetElemStartPos
(
pRuntimeEnv
->
pTSBuf
,
pQInfo
->
vgId
,
pT
ag
);
// failed to find data with the specified tag value and vnodeId
if
(
elem1
.
vnode
<
0
)
{
qError
(
"QInfo:%p failed to find tag:%s in ts_comp"
,
pQInfo
,
pRuntimeEnv
->
pCtx
[
0
].
tag
.
pz
);
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
qError
(
"QInfo:%p failed to find tag:%s in ts_comp"
,
pQInfo
,
pTag
->
pz
);
}
else
{
qError
(
"QInfo:%p failed to find tag:%"
PRId64
" in ts_comp"
,
pQInfo
,
pTag
->
i64Key
);
}
return
false
;
}
else
{
STSCursor
cur
=
tsBufGetCursor
(
pRuntimeEnv
->
pTSBuf
);
qDebug
(
"QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
pQInfo
,
pRuntimeEnv
->
pCtx
[
0
].
tag
.
pz
,
cur
.
blockIndex
,
cur
.
tsIndex
);
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
qDebug
(
"QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
pQInfo
,
pTag
->
pz
,
cur
.
blockIndex
,
cur
.
tsIndex
);
}
else
{
qDebug
(
"QInfo:%p find tag:%"
PRId64
" start pos in ts_comp, blockIndex:%d, tsIndex:%d"
,
pQInfo
,
pTag
->
i64Key
,
cur
.
blockIndex
,
cur
.
tsIndex
);
}
}
}
else
{
tsBufSetCursor
(
pRuntimeEnv
->
pTSBuf
,
&
pRuntimeEnv
->
cur
);
STSCursor
cur
=
tsBufGetCursor
(
pRuntimeEnv
->
pTSBuf
);
qDebug
(
"QInfo:%p continue scan ts_comp file, tag:%s blockIndex:%d, tsIndex:%d"
,
pQInfo
,
pRuntimeEnv
->
pCtx
[
0
].
tag
.
pz
,
cur
.
blockIndex
,
cur
.
tsIndex
);
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
qDebug
(
"QInfo:%p continue scan ts_comp file, tag:%s blockIndex:%d, tsIndex:%d"
,
pQInfo
,
pTag
->
pz
,
cur
.
blockIndex
,
cur
.
tsIndex
);
}
else
{
qDebug
(
"QInfo:%p continue scan ts_comp file, tag:%"
PRId64
" blockIndex:%d, tsIndex:%d"
,
pQInfo
,
pTag
->
i64Key
,
cur
.
blockIndex
,
cur
.
tsIndex
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录