Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3799db43
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看板
提交
3799db43
编写于
6月 23, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:sort table group if needed
上级
26cceaf1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
5 deletion
+37
-5
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+3
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+27
-4
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+7
-0
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
3799db43
...
...
@@ -226,7 +226,6 @@ int64_t tsdbGetNumOfRowsInMemTable(tsdbReaderT* pHandle) {
static
SArray
*
createCheckInfoFromTableGroup
(
STsdbReadHandle
*
pTsdbReadHandle
,
SArray
*
pTableList
)
{
size_t
tableSize
=
taosArrayGetSize
(
pTableList
);
assert
(
tableSize
>=
1
);
// allocate buffer in order to load data blocks from file
SArray
*
pTableCheckInfo
=
taosArrayInit
(
tableSize
,
sizeof
(
STableCheckInfo
));
...
...
@@ -510,6 +509,9 @@ int32_t tsdbSetTableList(tsdbReaderT reader, SArray* tableList){
tsdbReaderT
tsdbReaderOpen
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
SArray
*
tableList
,
uint64_t
qId
,
uint64_t
taskId
)
{
if
(
taosArrayGetSize
(
tableList
)
==
0
){
return
NULL
;
}
STsdbReadHandle
*
pTsdbReadHandle
=
tsdbQueryTablesImpl
(
pVnode
,
pCond
,
qId
,
taskId
);
if
(
pTsdbReadHandle
==
NULL
)
{
return
NULL
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
3799db43
...
...
@@ -510,6 +510,10 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
if
(
pInfo
->
currentGroupId
==
-
1
){
pInfo
->
currentGroupId
++
;
if
(
pInfo
->
currentGroupId
>=
taosArrayGetSize
(
pTaskInfo
->
tableqinfoList
.
pGroupList
))
{
doSetOperatorCompleted
(
pOperator
);
return
NULL
;
}
SArray
*
tableList
=
taosArrayGetP
(
pTaskInfo
->
tableqinfoList
.
pGroupList
,
pInfo
->
currentGroupId
);
tsdbReaderT
*
pReader
=
tsdbReaderOpen
(
pInfo
->
readHandle
.
vnode
,
&
pInfo
->
cond
,
tableList
,
pInfo
->
queryId
,
pInfo
->
taskId
);
pInfo
->
dataReader
=
pReader
;
...
...
@@ -2200,19 +2204,34 @@ SArray* generateSortByTsInfo(int32_t order) {
return
pList
;
}
static
int32_t
createMultipleDataReaders
(
SQueryTableDataCond
*
pQueryCond
,
SReadHandle
*
pHandle
,
SArray
*
tableList
,
SArray
*
arrayReader
,
uint64_t
queryId
,
uint64_t
taskId
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
tableList
);
++
i
)
{
SArray
*
tmp
=
taosArrayInit
(
1
,
sizeof
(
STableKeyInfo
));
taosArrayPush
(
tmp
,
taosArrayGet
(
tableList
,
i
));
tsdbReaderT
*
pReader
=
tsdbReaderOpen
(
pHandle
->
vnode
,
pQueryCond
,
tmp
,
queryId
,
taskId
);
taosArrayPush
(
arrayReader
,
&
pReader
);
taosArrayDestroy
(
tmp
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
startGroupTableMergeScan
(
SOperatorInfo
*
pOperator
)
{
STableMergeScanInfo
*
pInfo
=
pOperator
->
info
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SArray
*
tableList
=
taosArrayGetP
(
pInfo
->
tableListInfo
->
pGroupList
,
pInfo
->
currentGroupId
);
tsdbReaderT
*
pReader
=
tsdbReaderOpen
(
pInfo
->
readHandle
.
vnode
,
&
pInfo
->
cond
,
tableList
,
pInfo
->
queryId
,
pInfo
->
taskId
);
taosArrayPush
(
pInfo
->
dataReaders
,
&
pReader
);
createMultipleDataReaders
(
&
pInfo
->
cond
,
&
pInfo
->
readHandle
,
tableList
,
pInfo
->
dataReaders
,
pInfo
->
queryId
,
pInfo
->
taskId
);
// todo the total available buffer should be determined by total capacity of buffer of this task.
// the additional one is reserved for merge result
int32_t
tableLen
=
taosArrayGetSize
(
tableList
);
pInfo
->
sortBufSize
=
pInfo
->
bufPageSize
*
(
tableLen
+
1
);
pInfo
->
sortBufSize
=
pInfo
->
bufPageSize
*
(
(
tableLen
==
0
?
1
:
tableLen
)
+
1
);
int32_t
numOfBufPage
=
pInfo
->
sortBufSize
/
pInfo
->
bufPageSize
;
pInfo
->
pSortHandle
=
tsortCreateSortHandle
(
pInfo
->
pSortInfo
,
SORT_MULTISOURCE_MERGE
,
pInfo
->
bufPageSize
,
numOfBufPage
,
pInfo
->
pSortInputBlock
,
pTaskInfo
->
id
.
str
);
...
...
@@ -2302,6 +2321,10 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
if
(
pInfo
->
currentGroupId
==
-
1
)
{
pInfo
->
currentGroupId
++
;
if
(
pInfo
->
currentGroupId
>=
taosArrayGetSize
(
pInfo
->
tableListInfo
->
pGroupList
))
{
doSetOperatorCompleted
(
pOperator
);
return
NULL
;
}
startGroupTableMergeScan
(
pOperator
);
}
SSDataBlock
*
pBlock
=
getSortedTableMergeScanBlockData
(
pInfo
->
pSortHandle
,
pOperator
->
resultInfo
.
capacity
,
pOperator
);
...
...
@@ -2313,8 +2336,8 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
return
pBlock
;
}
pInfo
->
currentGroupId
++
;
stopGroupTableMergeScan
(
pOperator
);
pInfo
->
currentGroupId
++
;
if
(
pInfo
->
currentGroupId
>=
taosArrayGetSize
(
pInfo
->
tableListInfo
->
pGroupList
))
{
doSetOperatorCompleted
(
pOperator
);
return
NULL
;
...
...
tests/system-test/2-query/json_tag.py
浏览文件 @
3799db43
...
...
@@ -412,6 +412,13 @@ class TDTestCase:
tdSql
.
checkColNameList
(
res
,
cname_list
)
#
# test group by & order by json tag
tdSql
.
query
(
"select ts,jtag->'tag1' from jsons1 partition by jtag->'tag1' order by jtag->'tag1' desc"
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
0
,
1
,
'"femail"'
)
tdSql
.
checkData
(
2
,
1
,
'"收到货"'
)
tdSql
.
checkData
(
7
,
1
,
"false"
)
# tdSql.error("select count(*) from jsons1 group by jtag")
# tdSql.error("select count(*) from jsons1 partition by jtag")
# tdSql.error("select count(*) from jsons1 group by jtag order by jtag")
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录