Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ee34c3bb
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,发现更多精彩内容 >>
提交
ee34c3bb
编写于
7月 21, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): add query involved column info
上级
abfa6d91
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
43 addition
and
18 deletion
+43
-18
include/libs/executor/executor.h
include/libs/executor/executor.h
+1
-1
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+2
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+2
-1
source/dnode/vnode/src/tq/tqMeta.c
source/dnode/vnode/src/tq/tqMeta.c
+2
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-0
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+2
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+33
-13
未找到文件。
include/libs/executor/executor.h
浏览文件 @
ee34c3bb
...
...
@@ -64,7 +64,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers);
* @param SReadHandle
* @return
*/
qTaskInfo_t
qCreateQueueExecTaskInfo
(
void
*
msg
,
SReadHandle
*
readers
,
int32_t
*
numOfCols
);
qTaskInfo_t
qCreateQueueExecTaskInfo
(
void
*
msg
,
SReadHandle
*
readers
,
int32_t
*
numOfCols
,
SSchemaWrapper
**
pSchemaWrapper
);
/**
* Set the input data block for the stream scan.
...
...
source/dnode/vnode/src/inc/tq.h
浏览文件 @
ee34c3bb
...
...
@@ -88,7 +88,8 @@ typedef struct {
STqExecTb
execTb
;
STqExecDb
execDb
;
};
int32_t
numOfCols
;
// number of out pout column, temporarily used
int32_t
numOfCols
;
// number of out pout column, temporarily used
SSchemaWrapper
*
pSchemaWrapper
;
// columns that are involved in query
}
STqExecHandle
;
typedef
struct
{
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
ee34c3bb
...
...
@@ -506,7 +506,8 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
.
initTqReader
=
true
,
.
version
=
ver
,
};
pHandle
->
execHandle
.
execCol
.
task
[
i
]
=
qCreateQueueExecTaskInfo
(
pHandle
->
execHandle
.
execCol
.
qmsg
,
&
handle
,
&
pHandle
->
execHandle
.
numOfCols
);
pHandle
->
execHandle
.
execCol
.
task
[
i
]
=
qCreateQueueExecTaskInfo
(
pHandle
->
execHandle
.
execCol
.
qmsg
,
&
handle
,
&
pHandle
->
execHandle
.
numOfCols
,
&
pHandle
->
execHandle
.
pSchemaWrapper
);
ASSERT
(
pHandle
->
execHandle
.
execCol
.
task
[
i
]);
void
*
scanner
=
NULL
;
qExtractStreamScanner
(
pHandle
->
execHandle
.
execCol
.
task
[
i
],
&
scanner
);
...
...
source/dnode/vnode/src/tq/tqMeta.c
浏览文件 @
ee34c3bb
...
...
@@ -93,7 +93,8 @@ int32_t tqMetaOpen(STQ* pTq) {
.
version
=
handle
.
snapshotVer
,
};
handle
.
execHandle
.
execCol
.
task
[
i
]
=
qCreateQueueExecTaskInfo
(
handle
.
execHandle
.
execCol
.
qmsg
,
&
reader
,
&
handle
.
execHandle
.
numOfCols
);
handle
.
execHandle
.
execCol
.
task
[
i
]
=
qCreateQueueExecTaskInfo
(
handle
.
execHandle
.
execCol
.
qmsg
,
&
reader
,
&
handle
.
execHandle
.
numOfCols
,
&
handle
.
execHandle
.
pSchemaWrapper
);
ASSERT
(
handle
.
execHandle
.
execCol
.
task
[
i
]);
void
*
scanner
=
NULL
;
qExtractStreamScanner
(
handle
.
execHandle
.
execCol
.
task
[
i
],
&
scanner
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
ee34c3bb
...
...
@@ -164,6 +164,7 @@ typedef struct {
char
*
dbname
;
int32_t
tversion
;
SSchemaWrapper
*
sw
;
SSchemaWrapper
*
qsw
;
}
SSchemaInfo
;
typedef
struct
SExecTaskInfo
{
...
...
source/libs/executor/src/executor.c
浏览文件 @
ee34c3bb
...
...
@@ -104,7 +104,7 @@ int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numO
return
code
;
}
qTaskInfo_t
qCreateQueueExecTaskInfo
(
void
*
msg
,
SReadHandle
*
readers
,
int32_t
*
numOfCols
)
{
qTaskInfo_t
qCreateQueueExecTaskInfo
(
void
*
msg
,
SReadHandle
*
readers
,
int32_t
*
numOfCols
,
SSchemaWrapper
**
pSchemaWrapper
)
{
if
(
msg
==
NULL
)
{
// TODO create raw scan
return
NULL
;
...
...
@@ -138,6 +138,7 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
}
}
*
pSchemaWrapper
=
tCloneSSchemaWrapper
(((
SExecTaskInfo
*
)
pTaskInfo
)
->
schemaInfo
.
qsw
);;
return
pTaskInfo
;
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
ee34c3bb
...
...
@@ -4139,32 +4139,52 @@ static STsdbReader* doCreateDataReader(STableScanPhysiNode* pTableScanNode, SRea
static
SArray
*
extractColumnInfo
(
SNodeList
*
pNodeList
);
int32_t
extractTableSchemaInfo
(
SReadHandle
*
pHandle
,
uint64_t
uid
,
SExecTaskInfo
*
pTaskInfo
)
{
int32_t
extractTableSchemaInfo
(
SReadHandle
*
pHandle
,
SScanPhysiNode
*
pScanNode
,
SExecTaskInfo
*
pTaskInfo
)
{
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
int32_t
code
=
metaGetTableEntryByUid
(
&
mr
,
uid
);
int32_t
code
=
metaGetTableEntryByUid
(
&
mr
,
pScanNode
->
uid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
metaReaderClear
(
&
mr
);
return
terrno
;
}
pTaskInfo
->
schemaInfo
.
tablename
=
strdup
(
mr
.
me
.
name
);
SSchemaInfo
*
pSchemaInfo
=
&
pTaskInfo
->
schemaInfo
;
pSchemaInfo
->
tablename
=
strdup
(
mr
.
me
.
name
);
if
(
mr
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
p
TaskInfo
->
schemaInfo
.
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
p
TaskInfo
->
schemaInfo
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
p
SchemaInfo
->
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
p
SchemaInfo
->
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
}
else
if
(
mr
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
tDecoderClear
(
&
mr
.
coder
);
tb_uid_t
suid
=
mr
.
me
.
ctbEntry
.
suid
;
metaGetTableEntryByUid
(
&
mr
,
suid
);
p
TaskInfo
->
schemaInfo
.
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
p
TaskInfo
->
schemaInfo
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
p
SchemaInfo
->
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
p
SchemaInfo
->
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
}
else
{
p
TaskInfo
->
schemaInfo
.
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
ntbEntry
.
schemaRow
);
p
SchemaInfo
->
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
ntbEntry
.
schemaRow
);
}
metaReaderClear
(
&
mr
);
int32_t
numOfCols
=
LIST_LENGTH
(
pScanNode
->
pScanCols
);
SSchemaWrapper
*
pqSw
=
taosMemoryCalloc
(
1
,
sizeof
(
SSchemaWrapper
));
pqSw
->
pSchema
=
taosMemoryCalloc
(
numOfCols
,
sizeof
(
SSchema
));
pqSw
->
version
=
pSchemaInfo
->
sw
->
version
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
STargetNode
*
pNode
=
(
STargetNode
*
)
nodesListGetNode
(
pScanNode
->
pScanCols
,
i
);
SColumnNode
*
pColNode
=
(
SColumnNode
*
)
pNode
->
pExpr
;
for
(
int32_t
j
=
0
;
j
<
pSchemaInfo
->
sw
->
nCols
;
++
j
)
{
if
(
pColNode
->
colId
==
pSchemaInfo
->
sw
->
pSchema
[
j
].
colId
)
{
pqSw
->
pSchema
[
pqSw
->
nCols
++
]
=
pSchemaInfo
->
sw
->
pSchema
[
j
];
break
;
}
}
}
pSchemaInfo
->
qsw
=
pqSw
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -4175,8 +4195,8 @@ static void cleanupTableSchemaInfo(SSchemaInfo* pSchemaInfo) {
}
taosMemoryFree
(
pSchemaInfo
->
tablename
);
t
aosMemoryFree
(
pSchemaInfo
->
sw
->
pSchema
);
t
aosMemoryFree
(
pSchemaInfo
->
sw
);
t
DeleteSSchemaWrapper
(
pSchemaInfo
->
sw
);
t
DeleteSSchemaWrapper
(
pSchemaInfo
->
q
sw
);
}
static
int32_t
sortTableGroup
(
STableListInfo
*
pTableListInfo
,
int32_t
groupNum
)
{
...
...
@@ -4377,7 +4397,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return
NULL
;
}
code
=
extractTableSchemaInfo
(
pHandle
,
pTableScanNode
->
scan
.
uid
,
pTaskInfo
);
code
=
extractTableSchemaInfo
(
pHandle
,
&
pTableScanNode
->
scan
,
pTaskInfo
);
if
(
code
)
{
pTaskInfo
->
code
=
terrno
;
return
NULL
;
...
...
@@ -4397,7 +4417,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return
NULL
;
}
code
=
extractTableSchemaInfo
(
pHandle
,
pTableScanNode
->
scan
.
uid
,
pTaskInfo
);
code
=
extractTableSchemaInfo
(
pHandle
,
&
pTableScanNode
->
scan
,
pTaskInfo
);
if
(
code
)
{
pTaskInfo
->
code
=
terrno
;
return
NULL
;
...
...
@@ -4479,7 +4499,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return
NULL
;
}
code
=
extractTableSchemaInfo
(
pHandle
,
pScanNode
->
scan
.
uid
,
pTaskInfo
);
code
=
extractTableSchemaInfo
(
pHandle
,
&
pScanNode
->
scan
,
pTaskInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pTaskInfo
->
code
=
code
;
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录