Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
682b3b60
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
提交
682b3b60
编写于
11月 28, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into fix/TS-2149
上级
94c8ba64
1f77b78d
变更
52
展开全部
隐藏空白更改
内联
并排
Showing
52 changed file
with
2914 addition
and
3791 deletion
+2914
-3791
docs/zh/12-taos-sql/10-function.md
docs/zh/12-taos-sql/10-function.md
+1
-1
include/common/tcommon.h
include/common/tcommon.h
+20
-7
packaging/MPtestJenkinsfile
packaging/MPtestJenkinsfile
+18
-22
packaging/testpackage.sh
packaging/testpackage.sh
+5
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+12
-13
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+1
-0
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+1
-0
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+4
-4
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+1
-1
source/dnode/vnode/src/tq/tqOffset.c
source/dnode/vnode/src/tq/tqOffset.c
+1
-0
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+2
-2
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+5
-5
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+5
-5
source/dnode/vnode/test/tsdbSmaTest.cpp
source/dnode/vnode/test/tsdbSmaTest.cpp
+1
-1
source/libs/command/src/command.c
source/libs/command/src/command.c
+15
-9
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+12
-20
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+74
-148
source/libs/executor/src/cachescanoperator.c
source/libs/executor/src/cachescanoperator.c
+5
-5
source/libs/executor/src/exchangeoperator.c
source/libs/executor/src/exchangeoperator.c
+6
-6
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+2
-2
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+9
-8
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+48
-314
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+10
-10
source/libs/executor/src/joinoperator.c
source/libs/executor/src/joinoperator.c
+2
-2
source/libs/executor/src/projectoperator.c
source/libs/executor/src/projectoperator.c
+195
-16
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+45
-46
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+10
-10
source/libs/executor/src/sysscanoperator.c
source/libs/executor/src/sysscanoperator.c
+27
-27
source/libs/executor/src/tfill.c
source/libs/executor/src/tfill.c
+40
-21
source/libs/executor/src/timesliceoperator.c
source/libs/executor/src/timesliceoperator.c
+587
-0
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+80
-621
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+3
-3
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+0
-893
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+1
-1
source/libs/index/test/index_executor_tests.cpp
source/libs/index/test/index_executor_tests.cpp
+1
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-1
source/libs/parser/src/parCalcConst.c
source/libs/parser/src/parCalcConst.c
+30
-2
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1326
-1417
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+2
-2
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+1
-1
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+1
-1
source/libs/stream/src/streamUpdate.c
source/libs/stream/src/streamUpdate.c
+1
-1
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+38
-7
source/util/src/trbtree.c
source/util/src/trbtree.c
+200
-87
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+45
-45
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+3
-0
tests/system-test/0-others/udf_cluster.py
tests/system-test/0-others/udf_cluster.py
+2
-0
tests/system-test/6-cluster/5dnode1mnode.py
tests/system-test/6-cluster/5dnode1mnode.py
+3
-0
tests/system-test/6-cluster/5dnode3mnodeDrop.py
tests/system-test/6-cluster/5dnode3mnodeDrop.py
+6
-0
tests/system-test/6-cluster/5dnode3mnodeDropInsert.py
tests/system-test/6-cluster/5dnode3mnodeDropInsert.py
+2
-0
tests/system-test/6-cluster/5dnode3mnodeStopInsert.py
tests/system-test/6-cluster/5dnode3mnodeStopInsert.py
+2
-0
tests/system-test/test-all.bat
tests/system-test/test-all.bat
+2
-2
未找到文件。
docs/zh/12-taos-sql/10-function.md
浏览文件 @
682b3b60
...
@@ -1249,4 +1249,4 @@ SELECT SERVER_VERSION();
...
@@ -1249,4 +1249,4 @@ SELECT SERVER_VERSION();
SELECT
SERVER_STATUS
();
SELECT
SERVER_STATUS
();
```
```
**说明**
:
返回服务端当前的状态
。
**说明**
:
检测服务端是否所有 dnode 都在线,如果是则返回成功,否则返回无法建立连接的错误
。
include/common/tcommon.h
浏览文件 @
682b3b60
...
@@ -174,15 +174,28 @@ typedef struct SColumnDataAgg {
...
@@ -174,15 +174,28 @@ typedef struct SColumnDataAgg {
}
SColumnDataAgg
;
}
SColumnDataAgg
;
#pragma pack(pop)
#pragma pack(pop)
typedef
struct
SBlockID
{
// The uid of table, from which current data block comes. And it is always 0, if current block is the
// result of calculation.
uint64_t
uid
;
// Block id, acquired and assigned from executor, which created according to the hysical planner. Block id is used
// to mark the stage of exec task.
uint64_t
blockId
;
// Generated by group/partition by [value|tags]. Created and assigned by table-scan operator, group-by operator,
// and partition by operator.
uint64_t
groupId
;
}
SBlockID
;
typedef
struct
SDataBlockInfo
{
typedef
struct
SDataBlockInfo
{
STimeWindow
window
;
STimeWindow
window
;
int32_t
rows
;
// todo hide this attribute
int32_t
rowSize
;
int32_t
rowSize
;
uint64_t
uid
;
// the uid of table, from which current data block comes
int32_t
rows
;
// todo hide this attribute
uint16_t
blockId
;
// block id, generated by physical planner
uint64_t
groupId
;
int16_t
hasVarCol
;
uint32_t
capacity
;
uint32_t
capacity
;
SBlockID
id
;
int16_t
hasVarCol
;
// TODO: optimize and remove following
// TODO: optimize and remove following
int64_t
version
;
// used for stream, and need serialization
int64_t
version
;
// used for stream, and need serialization
int32_t
childId
;
// used for stream, do not serialize
int32_t
childId
;
// used for stream, do not serialize
...
@@ -190,8 +203,8 @@ typedef struct SDataBlockInfo {
...
@@ -190,8 +203,8 @@ typedef struct SDataBlockInfo {
STimeWindow
calWin
;
// used for stream, do not serialize
STimeWindow
calWin
;
// used for stream, do not serialize
TSKEY
watermark
;
// used for stream
TSKEY
watermark
;
// used for stream
char
parTbName
[
TSDB_TABLE_NAME_LEN
];
// used for stream partition
char
parTbName
[
TSDB_TABLE_NAME_LEN
];
// used for stream partition
STag
*
pTag
;
// used for stream partition
STag
*
pTag
;
// used for stream partition
}
SDataBlockInfo
;
}
SDataBlockInfo
;
typedef
struct
SSDataBlock
{
typedef
struct
SSDataBlock
{
...
...
packaging/MPtestJenkinsfile
浏览文件 @
682b3b60
...
@@ -120,20 +120,20 @@ pipeline {
...
@@ -120,20 +120,20 @@ pipeline {
for verModeSin in ${verModeList}
for verModeSin in ${verModeList}
do
do
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh
-f server
-m ${verModeSin} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m ${verModeSin} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
done
done
'''
'''
sh '''
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh
-f server
-m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
'''
'''
sh '''
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh
-f server
-m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t deb
bash testpackage.sh -m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t deb
python3 checkPackageRuning.py
python3 checkPackageRuning.py
'''
'''
}
}
...
@@ -152,20 +152,20 @@ pipeline {
...
@@ -152,20 +152,20 @@ pipeline {
for verModeSin in ${verModeList}
for verModeSin in ${verModeList}
do
do
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -
m ${verModeSin} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m ${verModeSin} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
done
done
'''
'''
sh '''
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -
m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
'''
'''
sh '''
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -
m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t deb
bash testpackage.sh -m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t deb
python3 checkPackageRuning.py
python3 checkPackageRuning.py
dpkg -r tdengine
dpkg -r tdengine
'''
'''
...
@@ -185,20 +185,20 @@ pipeline {
...
@@ -185,20 +185,20 @@ pipeline {
for verModeSin in ${verModeList}
for verModeSin in ${verModeList}
do
do
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -m community
-f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -
m ${verModeSin}
-f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
done
done
'''
'''
sh '''
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -
m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
'''
'''
sh '''
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -
m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t rpm
bash testpackage.sh -m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t rpm
python3 checkPackageRuning.py
python3 checkPackageRuning.py
'''
'''
}
}
...
@@ -217,20 +217,20 @@ pipeline {
...
@@ -217,20 +217,20 @@ pipeline {
for verModeSin in ${verModeList}
for verModeSin in ${verModeList}
do
do
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -
m ${verModeSin} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m ${verModeSin} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
done
done
'''
'''
sh '''
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -
m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
'''
'''
sh '''
sh '''
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -
m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t rpm
bash testpackage.sh -m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t rpm
python3 checkPackageRuning.py
python3 checkPackageRuning.py
sudo rpm -e tdengine
sudo rpm -e tdengine
'''
'''
...
@@ -250,7 +250,7 @@ pipeline {
...
@@ -250,7 +250,7 @@ pipeline {
for verModeSin in ${verModeList}
for verModeSin in ${verModeList}
do
do
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -
f server -
m ${verModeSin} -f server -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m ${verModeSin} -f server -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
done
done
'''
'''
...
@@ -273,10 +273,9 @@ pipeline {
...
@@ -273,10 +273,9 @@ pipeline {
for verModeSin in ${verModeList}
for verModeSin in ${verModeList}
do
do
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh
-f server
-m ${verModeSin} -f client -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m ${verModeSin} -f client -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
192.168.0.21
done
done
python3 checkPackageRuning.py 192.168.0.21
'''
'''
}
}
}
}
...
@@ -286,10 +285,8 @@ pipeline {
...
@@ -286,10 +285,8 @@ pipeline {
steps {
steps {
timeout(time: 30, unit: 'MINUTES'){
timeout(time: 30, unit: 'MINUTES'){
sh '''
sh '''
verModeList=community
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh -f server -m ${verModeSin} -f client -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m community -f client -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py 192.168.0.24
python3 checkPackageRuning.py 192.168.0.24
'''
'''
}
}
...
@@ -309,10 +306,9 @@ pipeline {
...
@@ -309,10 +306,9 @@ pipeline {
for verModeSin in ${verModeList}
for verModeSin in ${verModeList}
do
do
cd ${TDENGINE_ROOT_DIR}/packaging
cd ${TDENGINE_ROOT_DIR}/packaging
bash testpackage.sh
-f server
-m ${verModeSin} -f client -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
bash testpackage.sh -m ${verModeSin} -f client -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
python3 checkPackageRuning.py
python3 checkPackageRuning.py
192.168.0.21
done
done
python3 checkPackageRuning.py 192.168.0.21
'''
'''
}
}
}
}
...
...
packaging/testpackage.sh
浏览文件 @
682b3b60
...
@@ -206,6 +206,10 @@ else
...
@@ -206,6 +206,10 @@ else
fi
fi
if
[[
${
packgeName
}
=
~
"server"
]]
;
then
echoColor BD
" pkill -9 taosd "
pkill
-9
taosd
fi
echoColor G
"===== new workroom path ====="
echoColor G
"===== new workroom path ====="
...
@@ -334,7 +338,7 @@ elif ([[ ${packgeName} =~ "arm64" ]] && [[ ${packgeName} =~ "client" ]]);then
...
@@ -334,7 +338,7 @@ elif ([[ ${packgeName} =~ "arm64" ]] && [[ ${packgeName} =~ "client" ]]);then
echoColor G
"===== install taos-tools arm when package is arm64-client ====="
echoColor G
"===== install taos-tools arm when package is arm64-client ====="
cd
${
installPath
}
cd
${
installPath
}
if
[
!
-f
"taosTools-2.1.3-Linux-x64.tar.gz "
]
;
then
if
[
!
-f
"taosTools-2.1.3-Linux-x64.tar.gz "
]
;
then
wgetFile taosTools-2.1.3-Linux-
x
64.tar.gz v2.1.3 web
wgetFile taosTools-2.1.3-Linux-
arm
64.tar.gz v2.1.3 web
tar
xf taosTools-2.1.3-Linux-arm64.tar.gz
tar
xf taosTools-2.1.3-Linux-arm64.tar.gz
fi
fi
...
...
source/common/src/tdatablock.c
浏览文件 @
682b3b60
...
@@ -621,7 +621,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
...
@@ -621,7 +621,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
// todo remove this
// todo remove this
int32_t
blockDataFromBuf1
(
SSDataBlock
*
pBlock
,
const
char
*
buf
,
size_t
capacity
)
{
int32_t
blockDataFromBuf1
(
SSDataBlock
*
pBlock
,
const
char
*
buf
,
size_t
capacity
)
{
pBlock
->
info
.
rows
=
*
(
int32_t
*
)
buf
;
pBlock
->
info
.
rows
=
*
(
int32_t
*
)
buf
;
pBlock
->
info
.
groupId
=
*
(
uint64_t
*
)(
buf
+
sizeof
(
int32_t
));
pBlock
->
info
.
id
.
groupId
=
*
(
uint64_t
*
)(
buf
+
sizeof
(
int32_t
));
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
...
@@ -1140,7 +1140,8 @@ void blockDataCleanup(SSDataBlock* pDataBlock) {
...
@@ -1140,7 +1140,8 @@ void blockDataCleanup(SSDataBlock* pDataBlock) {
SDataBlockInfo
*
pInfo
=
&
pDataBlock
->
info
;
SDataBlockInfo
*
pInfo
=
&
pDataBlock
->
info
;
pInfo
->
rows
=
0
;
pInfo
->
rows
=
0
;
pInfo
->
groupId
=
0
;
pInfo
->
id
.
uid
=
0
;
pInfo
->
id
.
groupId
=
0
;
pInfo
->
window
.
ekey
=
0
;
pInfo
->
window
.
ekey
=
0
;
pInfo
->
window
.
skey
=
0
;
pInfo
->
window
.
skey
=
0
;
...
@@ -1334,7 +1335,7 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
...
@@ -1334,7 +1335,7 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
SSDataBlock
*
createSpecialDataBlock
(
EStreamType
type
)
{
SSDataBlock
*
createSpecialDataBlock
(
EStreamType
type
)
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
info
.
hasVarCol
=
false
;
pBlock
->
info
.
hasVarCol
=
false
;
pBlock
->
info
.
groupId
=
0
;
pBlock
->
info
.
id
.
groupId
=
0
;
pBlock
->
info
.
rows
=
0
;
pBlock
->
info
.
rows
=
0
;
pBlock
->
info
.
type
=
type
;
pBlock
->
info
.
type
=
type
;
pBlock
->
info
.
rowSize
=
sizeof
(
TSKEY
)
+
sizeof
(
TSKEY
)
+
sizeof
(
uint64_t
)
+
sizeof
(
uint64_t
)
+
sizeof
(
TSKEY
)
+
pBlock
->
info
.
rowSize
=
sizeof
(
TSKEY
)
+
sizeof
(
TSKEY
)
+
sizeof
(
uint64_t
)
+
sizeof
(
uint64_t
)
+
sizeof
(
TSKEY
)
+
...
@@ -1675,7 +1676,7 @@ int32_t blockDataKeepFirstNRows(SSDataBlock* pBlock, size_t n) {
...
@@ -1675,7 +1676,7 @@ int32_t blockDataKeepFirstNRows(SSDataBlock* pBlock, size_t n) {
}
}
int32_t
tEncodeDataBlock
(
void
**
buf
,
const
SSDataBlock
*
pBlock
)
{
int32_t
tEncodeDataBlock
(
void
**
buf
,
const
SSDataBlock
*
pBlock
)
{
int64_t
tbUid
=
pBlock
->
info
.
uid
;
int64_t
tbUid
=
pBlock
->
info
.
id
.
uid
;
int16_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
int16_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
int16_t
hasVarCol
=
pBlock
->
info
.
hasVarCol
;
int16_t
hasVarCol
=
pBlock
->
info
.
hasVarCol
;
int32_t
rows
=
pBlock
->
info
.
rows
;
int32_t
rows
=
pBlock
->
info
.
rows
;
...
@@ -1713,7 +1714,7 @@ void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock) {
...
@@ -1713,7 +1714,7 @@ void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock) {
int16_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
int16_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
buf
=
taosDecodeFixedU64
(
buf
,
&
pBlock
->
info
.
uid
);
buf
=
taosDecodeFixedU64
(
buf
,
&
pBlock
->
info
.
id
.
uid
);
buf
=
taosDecodeFixedI16
(
buf
,
&
numOfCols
);
buf
=
taosDecodeFixedI16
(
buf
,
&
numOfCols
);
buf
=
taosDecodeFixedI16
(
buf
,
&
pBlock
->
info
.
hasVarCol
);
buf
=
taosDecodeFixedI16
(
buf
,
&
pBlock
->
info
.
hasVarCol
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pBlock
->
info
.
rows
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pBlock
->
info
.
rows
);
...
@@ -1834,7 +1835,7 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) {
...
@@ -1834,7 +1835,7 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) {
int32_t
rows
=
pDataBlock
->
info
.
rows
;
int32_t
rows
=
pDataBlock
->
info
.
rows
;
printf
(
"%s |block ver %"
PRIi64
" |block type %d |child id %d|group id %"
PRIu64
"
\n
"
,
flag
,
printf
(
"%s |block ver %"
PRIi64
" |block type %d |child id %d|group id %"
PRIu64
"
\n
"
,
flag
,
pDataBlock
->
info
.
version
,
(
int32_t
)
pDataBlock
->
info
.
type
,
pDataBlock
->
info
.
childId
,
pDataBlock
->
info
.
version
,
(
int32_t
)
pDataBlock
->
info
.
type
,
pDataBlock
->
info
.
childId
,
pDataBlock
->
info
.
groupId
);
pDataBlock
->
info
.
id
.
groupId
);
for
(
int32_t
j
=
0
;
j
<
rows
;
j
++
)
{
for
(
int32_t
j
=
0
;
j
<
rows
;
j
++
)
{
printf
(
"%s |"
,
flag
);
printf
(
"%s |"
,
flag
);
for
(
int32_t
k
=
0
;
k
<
numOfCols
;
k
++
)
{
for
(
int32_t
k
=
0
;
k
<
numOfCols
;
k
++
)
{
...
@@ -1905,8 +1906,8 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
...
@@ -1905,8 +1906,8 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
len
+=
snprintf
(
dumpBuf
+
len
,
size
-
len
,
len
+=
snprintf
(
dumpBuf
+
len
,
size
-
len
,
"===stream===%s|block type %d|child id %d|group id:%"
PRIu64
"|uid:%"
PRId64
"===stream===%s|block type %d|child id %d|group id:%"
PRIu64
"|uid:%"
PRId64
"|rows:%d|version:%"
PRIu64
"
\n
"
,
"|rows:%d|version:%"
PRIu64
"
\n
"
,
flag
,
(
int32_t
)
pDataBlock
->
info
.
type
,
pDataBlock
->
info
.
childId
,
pDataBlock
->
info
.
groupId
,
flag
,
(
int32_t
)
pDataBlock
->
info
.
type
,
pDataBlock
->
info
.
childId
,
pDataBlock
->
info
.
id
.
groupId
,
pDataBlock
->
info
.
uid
,
pDataBlock
->
info
.
rows
,
pDataBlock
->
info
.
version
);
pDataBlock
->
info
.
id
.
uid
,
pDataBlock
->
info
.
rows
,
pDataBlock
->
info
.
version
);
if
(
len
>=
size
-
1
)
return
dumpBuf
;
if
(
len
>=
size
-
1
)
return
dumpBuf
;
for
(
int32_t
j
=
0
;
j
<
rows
;
j
++
)
{
for
(
int32_t
j
=
0
;
j
<
rows
;
j
++
)
{
...
@@ -2035,8 +2036,6 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
...
@@ -2035,8 +2036,6 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
for
(
int32_t
i
=
0
;
i
<
sz
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
sz
;
++
i
)
{
int32_t
colNum
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
);
int32_t
colNum
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
);
int32_t
rows
=
pDataBlock
->
info
.
rows
;
int32_t
rows
=
pDataBlock
->
info
.
rows
;
// int32_t rowSize = pDataBlock->info.rowSize;
// int64_t groupId = pDataBlock->info.groupId;
if
(
colNum
<=
1
)
{
if
(
colNum
<=
1
)
{
// invalid if only with TS col
// invalid if only with TS col
...
@@ -2049,7 +2048,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
...
@@ -2049,7 +2048,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
SSubmitBlk
*
pSubmitBlk
=
POINTER_SHIFT
(
pDataBuf
,
msgLen
);
SSubmitBlk
*
pSubmitBlk
=
POINTER_SHIFT
(
pDataBuf
,
msgLen
);
pSubmitBlk
->
suid
=
suid
;
pSubmitBlk
->
suid
=
suid
;
pSubmitBlk
->
uid
=
pDataBlock
->
info
.
groupId
;
pSubmitBlk
->
uid
=
pDataBlock
->
info
.
id
.
groupId
;
pSubmitBlk
->
numOfRows
=
rows
;
pSubmitBlk
->
numOfRows
=
rows
;
pSubmitBlk
->
sversion
=
pTSchema
->
version
;
pSubmitBlk
->
sversion
=
pTSchema
->
version
;
...
@@ -2292,7 +2291,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
...
@@ -2292,7 +2291,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
}
}
*
actualLen
=
dataLen
;
*
actualLen
=
dataLen
;
*
groupId
=
pBlock
->
info
.
groupId
;
*
groupId
=
pBlock
->
info
.
id
.
groupId
;
ASSERT
(
dataLen
>
0
);
ASSERT
(
dataLen
>
0
);
uDebug
(
"build data block, actualLen:%d, rows:%d, cols:%d"
,
dataLen
,
*
rows
,
*
cols
);
uDebug
(
"build data block, actualLen:%d, rows:%d, cols:%d"
,
dataLen
,
*
rows
,
*
cols
);
...
@@ -2325,7 +2324,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
...
@@ -2325,7 +2324,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
pStart
+=
sizeof
(
int32_t
);
pStart
+=
sizeof
(
int32_t
);
// group id sizeof(uint64_t)
// group id sizeof(uint64_t)
pBlock
->
info
.
groupId
=
*
(
uint64_t
*
)
pStart
;
pBlock
->
info
.
id
.
groupId
=
*
(
uint64_t
*
)
pStart
;
pStart
+=
sizeof
(
uint64_t
);
pStart
+=
sizeof
(
uint64_t
);
if
(
pBlock
->
pDataBlock
==
NULL
)
{
if
(
pBlock
->
pDataBlock
==
NULL
)
{
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
682b3b60
...
@@ -525,6 +525,7 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
...
@@ -525,6 +525,7 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
tFreeSMCreateStbReq
(
&
createReq
);
tFreeSMCreateStbReq
(
&
createReq
);
mndFreeStb
(
&
stbObj
);
mndFreeStb
(
&
stbObj
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
return
0
;
return
0
;
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
682b3b60
...
@@ -434,6 +434,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
...
@@ -434,6 +434,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
return
-
1
;
return
-
1
;
}
}
topicObj
.
stbUid
=
pStb
->
uid
;
topicObj
.
stbUid
=
pStb
->
uid
;
mndReleaseStb
(
pMnode
,
pStb
);
}
}
/*} else if (pCreate->subType == TOPIC_SUB_TYPE__DB) {*/
/*} else if (pCreate->subType == TOPIC_SUB_TYPE__DB) {*/
/*topicObj.ast = NULL;*/
/*topicObj.ast = NULL;*/
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
682b3b60
...
@@ -708,7 +708,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
...
@@ -708,7 +708,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
#endif
#endif
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pResList
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pResList
);
++
i
)
{
SSDataBlock
*
output
=
taosArrayGetP
(
pResList
,
i
);
SSDataBlock
*
output
=
taosArrayGetP
(
pResList
,
i
);
smaDebug
(
"result block, uid:%"
PRIu64
", groupid:%"
PRIu64
", rows:%d"
,
output
->
info
.
uid
,
output
->
info
.
groupId
,
smaDebug
(
"result block, uid:%"
PRIu64
", groupid:%"
PRIu64
", rows:%d"
,
output
->
info
.
id
.
uid
,
output
->
info
.
id
.
groupId
,
output
->
info
.
rows
);
output
->
info
.
rows
);
STsdb
*
sinkTsdb
=
(
pItem
->
level
==
TSDB_RETENTION_L1
?
pSma
->
pRSmaTsdb
[
0
]
:
pSma
->
pRSmaTsdb
[
1
]);
STsdb
*
sinkTsdb
=
(
pItem
->
level
==
TSDB_RETENTION_L1
?
pSma
->
pRSmaTsdb
[
0
]
:
pSma
->
pRSmaTsdb
[
1
]);
...
@@ -718,7 +718,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
...
@@ -718,7 +718,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
if
(
buildSubmitReqFromDataBlock
(
&
pReq
,
output
,
pTSchema
,
SMA_VID
(
pSma
),
suid
)
<
0
)
{
if
(
buildSubmitReqFromDataBlock
(
&
pReq
,
output
,
pTSchema
,
SMA_VID
(
pSma
),
suid
)
<
0
)
{
smaError
(
"vgId:%d, build submit req for rsma table suid:%"
PRIu64
", uid:%"
PRIu64
", level %"
PRIi8
smaError
(
"vgId:%d, build submit req for rsma table suid:%"
PRIu64
", uid:%"
PRIu64
", level %"
PRIi8
" failed since %s"
,
" failed since %s"
,
SMA_VID
(
pSma
),
suid
,
output
->
info
.
groupId
,
pItem
->
level
,
terrstr
());
SMA_VID
(
pSma
),
suid
,
output
->
info
.
id
.
groupId
,
pItem
->
level
,
terrstr
());
goto
_err
;
goto
_err
;
}
}
...
@@ -726,13 +726,13 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
...
@@ -726,13 +726,13 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
taosMemoryFreeClear
(
pReq
);
taosMemoryFreeClear
(
pReq
);
smaError
(
"vgId:%d, process submit req for rsma suid:%"
PRIu64
", uid:%"
PRIu64
" level %"
PRIi8
smaError
(
"vgId:%d, process submit req for rsma suid:%"
PRIu64
", uid:%"
PRIu64
" level %"
PRIi8
" failed since %s"
,
" failed since %s"
,
SMA_VID
(
pSma
),
suid
,
output
->
info
.
groupId
,
pItem
->
level
,
terrstr
());
SMA_VID
(
pSma
),
suid
,
output
->
info
.
id
.
groupId
,
pItem
->
level
,
terrstr
());
goto
_err
;
goto
_err
;
}
}
smaDebug
(
"vgId:%d, process submit req for rsma suid:%"
PRIu64
",uid:%"
PRIu64
", level %"
PRIi8
" ver %"
PRIi64
smaDebug
(
"vgId:%d, process submit req for rsma suid:%"
PRIu64
",uid:%"
PRIu64
", level %"
PRIi8
" ver %"
PRIi64
" len %"
PRIu32
,
" len %"
PRIu32
,
SMA_VID
(
pSma
),
suid
,
output
->
info
.
groupId
,
pItem
->
level
,
output
->
info
.
version
,
SMA_VID
(
pSma
),
suid
,
output
->
info
.
id
.
groupId
,
pItem
->
level
,
output
->
info
.
version
,
htonl
(
pReq
->
header
.
contLen
));
htonl
(
pReq
->
header
.
contLen
));
taosMemoryFreeClear
(
pReq
);
taosMemoryFreeClear
(
pReq
);
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
682b3b60
...
@@ -299,7 +299,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp
...
@@ -299,7 +299,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp
taosArrayDestroyP
(
pSchemas
,
(
FDelete
)
tDeleteSSchemaWrapper
);
taosArrayDestroyP
(
pSchemas
,
(
FDelete
)
tDeleteSSchemaWrapper
);
pBlocks
=
taosArrayInit
(
0
,
sizeof
(
SSDataBlock
));
pBlocks
=
taosArrayInit
(
0
,
sizeof
(
SSDataBlock
));
pSchemas
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
pSchemas
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
return
-
1
;
continue
;
}
}
}
}
if
(
pHandle
->
fetchMeta
)
{
if
(
pHandle
->
fetchMeta
)
{
...
...
source/dnode/vnode/src/tq/tqOffset.c
浏览文件 @
682b3b60
...
@@ -61,6 +61,7 @@ int32_t tqOffsetRestoreFromFile(STqOffsetStore* pStore, const char* fname) {
...
@@ -61,6 +61,7 @@ int32_t tqOffsetRestoreFromFile(STqOffsetStore* pStore, const char* fname) {
ASSERT
(
0
);
ASSERT
(
0
);
// TODO
// TODO
}
}
taosMemoryFree
(
memBuf
);
}
}
taosCloseFile
(
&
pFile
);
taosCloseFile
(
&
pFile
);
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
682b3b60
...
@@ -530,7 +530,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) {
...
@@ -530,7 +530,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) {
tInitSubmitBlkIter
(
&
pReader
->
msgIter
,
pReader
->
pBlock
,
&
pReader
->
blkIter
);
tInitSubmitBlkIter
(
&
pReader
->
msgIter
,
pReader
->
pBlock
,
&
pReader
->
blkIter
);
pBlock
->
info
.
uid
=
pReader
->
msgIter
.
uid
;
pBlock
->
info
.
id
.
uid
=
pReader
->
msgIter
.
uid
;
pBlock
->
info
.
rows
=
pReader
->
msgIter
.
numOfRows
;
pBlock
->
info
.
rows
=
pReader
->
msgIter
.
numOfRows
;
pBlock
->
info
.
version
=
pReader
->
pMsg
->
version
;
pBlock
->
info
.
version
=
pReader
->
pMsg
->
version
;
...
@@ -649,7 +649,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas
...
@@ -649,7 +649,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas
}
}
SSDataBlock
*
pBlock
=
taosArrayGetLast
(
blocks
);
SSDataBlock
*
pBlock
=
taosArrayGetLast
(
blocks
);
pBlock
->
info
.
uid
=
pReader
->
msgIter
.
uid
;
pBlock
->
info
.
id
.
uid
=
pReader
->
msgIter
.
uid
;
pBlock
->
info
.
rows
=
0
;
pBlock
->
info
.
rows
=
0
;
pBlock
->
info
.
version
=
pReader
->
pMsg
->
version
;
pBlock
->
info
.
version
=
pReader
->
pMsg
->
version
;
...
...
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
682b3b60
...
@@ -103,7 +103,7 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
...
@@ -103,7 +103,7 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
// STagVal tagVal = {
// STagVal tagVal = {
// .cid = pTagSchemaWrapper->pSchema[j].colId,
// .cid = pTagSchemaWrapper->pSchema[j].colId,
// .type = pTagSchemaWrapper->pSchema[j].type,
// .type = pTagSchemaWrapper->pSchema[j].type,
// .i64 = (int64_t)pDataBlock->info.groupId,
// .i64 = (int64_t)pDataBlock->info.
id.
groupId,
// };
// };
// taosArrayPush(tagArray, &tagVal);
// taosArrayPush(tagArray, &tagVal);
// taosArrayPush(tagName, pTagSchemaWrapper->pSchema[j].name);
// taosArrayPush(tagName, pTagSchemaWrapper->pSchema[j].name);
...
@@ -134,7 +134,7 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
...
@@ -134,7 +134,7 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
STagVal
tagVal
=
{
STagVal
tagVal
=
{
.
cid
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
+
1
,
.
cid
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
+
1
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
i64
=
(
int64_t
)
pDataBlock
->
info
.
groupId
,
.
i64
=
(
int64_t
)
pDataBlock
->
info
.
id
.
groupId
,
};
};
taosArrayPush
(
tagArray
,
&
tagVal
);
taosArrayPush
(
tagArray
,
&
tagVal
);
createTbReq
.
ctb
.
tagNum
=
taosArrayGetSize
(
tagArray
);
createTbReq
.
ctb
.
tagNum
=
taosArrayGetSize
(
tagArray
);
...
@@ -161,7 +161,7 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
...
@@ -161,7 +161,7 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
if
(
pDataBlock
->
info
.
parTbName
[
0
])
{
if
(
pDataBlock
->
info
.
parTbName
[
0
])
{
createTbReq
.
name
=
strdup
(
pDataBlock
->
info
.
parTbName
);
createTbReq
.
name
=
strdup
(
pDataBlock
->
info
.
parTbName
);
}
else
{
}
else
{
createTbReq
.
name
=
buildCtbNameByGroupId
(
stbFullName
,
pDataBlock
->
info
.
groupId
);
createTbReq
.
name
=
buildCtbNameByGroupId
(
stbFullName
,
pDataBlock
->
info
.
id
.
groupId
);
}
}
// save schema len
// save schema len
...
@@ -358,7 +358,7 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
...
@@ -358,7 +358,7 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
if
(
pDataBlock
->
info
.
parTbName
[
0
])
{
if
(
pDataBlock
->
info
.
parTbName
[
0
])
{
ctbName
=
strdup
(
pDataBlock
->
info
.
parTbName
);
ctbName
=
strdup
(
pDataBlock
->
info
.
parTbName
);
}
else
{
}
else
{
ctbName
=
buildCtbNameByGroupId
(
stbFullName
,
pDataBlock
->
info
.
groupId
);
ctbName
=
buildCtbNameByGroupId
(
stbFullName
,
pDataBlock
->
info
.
id
.
groupId
);
}
}
int32_t
schemaLen
=
0
;
int32_t
schemaLen
=
0
;
...
@@ -390,7 +390,7 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
...
@@ -390,7 +390,7 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
STagVal
tagVal
=
{
STagVal
tagVal
=
{
.
cid
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
+
1
,
.
cid
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
+
1
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
i64
=
(
int64_t
)
pDataBlock
->
info
.
groupId
,
.
i64
=
(
int64_t
)
pDataBlock
->
info
.
id
.
groupId
,
};
};
taosArrayPush
(
tagArray
,
&
tagVal
);
taosArrayPush
(
tagArray
,
&
tagVal
);
createTbReq
.
ctb
.
tagNum
=
taosArrayGetSize
(
tagArray
);
createTbReq
.
ctb
.
tagNum
=
taosArrayGetSize
(
tagArray
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
682b3b60
...
@@ -1624,7 +1624,7 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo*
...
@@ -1624,7 +1624,7 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo*
int32_t
code
=
buildDataBlockFromBufImpl
(
pBlockScanInfo
,
endKey
,
pReader
->
capacity
,
pReader
);
int32_t
code
=
buildDataBlockFromBufImpl
(
pBlockScanInfo
,
endKey
,
pReader
->
capacity
,
pReader
);
blockDataUpdateTsWindow
(
pBlock
,
0
);
blockDataUpdateTsWindow
(
pBlock
,
0
);
pBlock
->
info
.
uid
=
pBlockScanInfo
->
uid
;
pBlock
->
info
.
id
.
uid
=
pBlockScanInfo
->
uid
;
setComposedBlockFlag
(
pReader
,
true
);
setComposedBlockFlag
(
pReader
,
true
);
...
@@ -2494,7 +2494,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
...
@@ -2494,7 +2494,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
}
}
_end:
_end:
pResBlock
->
info
.
uid
=
(
pBlockScanInfo
!=
NULL
)
?
pBlockScanInfo
->
uid
:
0
;
pResBlock
->
info
.
id
.
uid
=
(
pBlockScanInfo
!=
NULL
)
?
pBlockScanInfo
->
uid
:
0
;
blockDataUpdateTsWindow
(
pResBlock
,
0
);
blockDataUpdateTsWindow
(
pResBlock
,
0
);
setComposedBlockFlag
(
pReader
,
true
);
setComposedBlockFlag
(
pReader
,
true
);
...
@@ -2506,7 +2506,7 @@ _end:
...
@@ -2506,7 +2506,7 @@ _end:
if
(
pResBlock
->
info
.
rows
>
0
)
{
if
(
pResBlock
->
info
.
rows
>
0
)
{
tsdbDebug
(
"%p uid:%"
PRIu64
", composed data block created, brange:%"
PRIu64
"-%"
PRIu64
tsdbDebug
(
"%p uid:%"
PRIu64
", composed data block created, brange:%"
PRIu64
"-%"
PRIu64
" rows:%d, elapsed time:%.2f ms %s"
,
" rows:%d, elapsed time:%.2f ms %s"
,
pReader
,
pResBlock
->
info
.
uid
,
pResBlock
->
info
.
window
.
skey
,
pResBlock
->
info
.
window
.
ekey
,
pReader
,
pResBlock
->
info
.
id
.
uid
,
pResBlock
->
info
.
window
.
skey
,
pResBlock
->
info
.
window
.
ekey
,
pResBlock
->
info
.
rows
,
el
,
pReader
->
idStr
);
pResBlock
->
info
.
rows
,
el
,
pReader
->
idStr
);
}
}
...
@@ -2830,7 +2830,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
...
@@ -2830,7 +2830,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
}
else
{
// whole block is required, return it directly
}
else
{
// whole block is required, return it directly
SDataBlockInfo
*
pInfo
=
&
pReader
->
pResBlock
->
info
;
SDataBlockInfo
*
pInfo
=
&
pReader
->
pResBlock
->
info
;
pInfo
->
rows
=
pBlock
->
nRow
;
pInfo
->
rows
=
pBlock
->
nRow
;
pInfo
->
uid
=
pScanInfo
->
uid
;
pInfo
->
id
.
uid
=
pScanInfo
->
uid
;
pInfo
->
window
=
(
STimeWindow
){.
skey
=
pBlock
->
minKey
.
ts
,
.
ekey
=
pBlock
->
maxKey
.
ts
};
pInfo
->
window
=
(
STimeWindow
){.
skey
=
pBlock
->
minKey
.
ts
,
.
ekey
=
pBlock
->
maxKey
.
ts
};
setComposedBlockFlag
(
pReader
,
false
);
setComposedBlockFlag
(
pReader
,
false
);
setBlockAllDumped
(
&
pStatus
->
fBlockDumpInfo
,
pBlock
->
maxKey
.
ts
,
pReader
->
order
);
setBlockAllDumped
(
&
pStatus
->
fBlockDumpInfo
,
pBlock
->
maxKey
.
ts
,
pReader
->
order
);
...
@@ -4020,7 +4020,7 @@ bool tsdbTableNextDataBlock(STsdbReader* pReader, uint64_t uid) {
...
@@ -4020,7 +4020,7 @@ bool tsdbTableNextDataBlock(STsdbReader* pReader, uint64_t uid) {
static
void
setBlockInfo
(
const
STsdbReader
*
pReader
,
int32_t
*
rows
,
uint64_t
*
uid
,
STimeWindow
*
pWindow
)
{
static
void
setBlockInfo
(
const
STsdbReader
*
pReader
,
int32_t
*
rows
,
uint64_t
*
uid
,
STimeWindow
*
pWindow
)
{
ASSERT
(
pReader
!=
NULL
);
ASSERT
(
pReader
!=
NULL
);
*
rows
=
pReader
->
pResBlock
->
info
.
rows
;
*
rows
=
pReader
->
pResBlock
->
info
.
rows
;
*
uid
=
pReader
->
pResBlock
->
info
.
uid
;
*
uid
=
pReader
->
pResBlock
->
info
.
id
.
uid
;
*
pWindow
=
pReader
->
pResBlock
->
info
.
window
;
*
pWindow
=
pReader
->
pResBlock
->
info
.
window
;
}
}
...
...
source/dnode/vnode/test/tsdbSmaTest.cpp
浏览文件 @
682b3b60
...
@@ -436,7 +436,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
...
@@ -436,7 +436,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
pDataBlock
->
pBlockAgg
=
NULL
;
pDataBlock
->
pBlockAgg
=
NULL
;
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
=
tSmaNumOfCols
;
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
=
tSmaNumOfCols
;
pDataBlock
->
info
.
rows
=
tSmaNumOfRows
;
pDataBlock
->
info
.
rows
=
tSmaNumOfRows
;
pDataBlock
->
info
.
groupId
=
tSmaGroupId
+
g
;
pDataBlock
->
info
.
id
.
groupId
=
tSmaGroupId
+
g
;
pDataBlock
->
pDataBlock
=
taosArrayInit
(
tSmaNumOfCols
,
sizeof
(
SColumnInfoData
*
));
pDataBlock
->
pDataBlock
=
taosArrayInit
(
tSmaNumOfCols
,
sizeof
(
SColumnInfoData
*
));
EXPECT_NE
(
pDataBlock
->
pDataBlock
,
nullptr
);
EXPECT_NE
(
pDataBlock
->
pDataBlock
,
nullptr
);
...
...
source/libs/command/src/command.c
浏览文件 @
682b3b60
...
@@ -270,10 +270,10 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
...
@@ -270,10 +270,10 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"STRICT '%s' WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d"
,
"STRICT '%s' WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d"
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheSize
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
walFsyncPeriod
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheSize
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
pages
,
pCfg
->
walFsyncPeriod
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
page
Size
,
prec
,
pCfg
->
replications
,
strictStr
(
pCfg
->
strict
),
pCfg
->
walLevel
,
pCfg
->
numOfVgroups
,
pCfg
->
page
s
,
pCfg
->
pageSize
,
prec
,
pCfg
->
replications
,
strictStr
(
pCfg
->
strict
),
pCfg
->
walLevel
,
1
==
pCfg
->
numOfStables
);
pCfg
->
numOfVgroups
,
1
==
pCfg
->
numOfStables
);
if
(
retentions
)
{
if
(
retentions
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
" RETENTIONS %s"
,
retentions
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
" RETENTIONS %s"
,
retentions
);
...
@@ -500,8 +500,8 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
...
@@ -500,8 +500,8 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
terrno
;
return
terrno
;
}
}
int32_t
len
=
0
;
int32_t
len
=
0
;
if
(
TSDB_SUPER_TABLE
==
pCfg
->
tableType
)
{
if
(
TSDB_SUPER_TABLE
==
pCfg
->
tableType
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE STABLE `%s` ("
,
tbName
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE STABLE `%s` ("
,
tbName
);
...
@@ -533,7 +533,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
...
@@ -533,7 +533,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
colDataAppend
(
pCol2
,
0
,
buf2
,
false
);
colDataAppend
(
pCol2
,
0
,
buf2
,
false
);
taosMemoryFree
(
buf2
);
taosMemoryFree
(
buf2
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -691,9 +691,15 @@ static int32_t createSelectResultDataBlock(SNodeList* pProjects, SSDataBlock** p
...
@@ -691,9 +691,15 @@ static int32_t createSelectResultDataBlock(SNodeList* pProjects, SSDataBlock** p
SNode
*
pProj
=
NULL
;
SNode
*
pProj
=
NULL
;
FOREACH
(
pProj
,
pProjects
)
{
FOREACH
(
pProj
,
pProjects
)
{
SExprNode
*
pExpr
=
(
SExprNode
*
)
pProj
;
SColumnInfoData
infoData
=
{
0
};
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
((
SExprNode
*
)
pProj
)
->
resType
.
type
;
if
(
TSDB_DATA_TYPE_NULL
==
pExpr
->
resType
.
type
)
{
infoData
.
info
.
bytes
=
((
SExprNode
*
)
pProj
)
->
resType
.
bytes
;
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
0
;
}
else
{
infoData
.
info
.
type
=
pExpr
->
resType
.
type
;
infoData
.
info
.
bytes
=
pExpr
->
resType
.
bytes
;
}
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
}
}
*
pOutput
=
pBlock
;
*
pOutput
=
pBlock
;
...
...
source/libs/executor/inc/executil.h
浏览文件 @
682b3b60
...
@@ -38,16 +38,7 @@
...
@@ -38,16 +38,7 @@
memcpy((_k) + sizeof(uint64_t), (_ori), (_len)); \
memcpy((_k) + sizeof(uint64_t), (_ori), (_len)); \
} while (0)
} while (0)
#define SET_RES_EXT_WINDOW_KEY(_k, _ori, _len, _uid, _buf) \
do { \
assert(sizeof(_uid) == sizeof(uint64_t)); \
*(void**)(_k) = (_buf); \
*(uint64_t*)((_k) + POINTER_BYTES) = (_uid); \
memcpy((_k) + POINTER_BYTES + sizeof(uint64_t), (_ori), (_len)); \
} while (0)
#define GET_RES_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t))
#define GET_RES_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t))
#define GET_RES_EXT_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t) + POINTER_BYTES)
#define GET_TASKID(_t) (((SExecTaskInfo*)(_t))->id.str)
#define GET_TASKID(_t) (((SExecTaskInfo*)(_t))->id.str)
...
@@ -104,16 +95,17 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
...
@@ -104,16 +95,17 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
STableListInfo
*
pTableListInfo
,
SNode
*
pTagCond
,
SNode
*
pTagIndexCond
,
SExecTaskInfo
*
pTaskInfo
);
STableListInfo
*
pTableListInfo
,
SNode
*
pTagCond
,
SNode
*
pTagIndexCond
,
SExecTaskInfo
*
pTaskInfo
);
STableListInfo
*
tableListCreate
();
STableListInfo
*
tableListCreate
();
void
*
tableListDestroy
(
STableListInfo
*
pTableListInfo
);
void
*
tableListDestroy
(
STableListInfo
*
pTableListInfo
);
void
tableListClear
(
STableListInfo
*
pTableListInfo
);
void
tableListClear
(
STableListInfo
*
pTableListInfo
);
int32_t
tableListGetOutputGroups
(
const
STableListInfo
*
pTableList
);
int32_t
tableListGetOutputGroups
(
const
STableListInfo
*
pTableList
);
bool
oneTableForEachGroup
(
const
STableListInfo
*
pTableList
);
bool
oneTableForEachGroup
(
const
STableListInfo
*
pTableList
);
uint64_t
getTableGroupId
(
const
STableListInfo
*
pTableList
,
uint64_t
tableUid
);
uint64_t
getTableGroupId
(
const
STableListInfo
*
pTableList
,
uint64_t
tableUid
);
int32_t
tableListAddTableInfo
(
STableListInfo
*
pTableList
,
uint64_t
uid
,
uint64_t
gid
);
int32_t
tableListAddTableInfo
(
STableListInfo
*
pTableList
,
uint64_t
uid
,
uint64_t
gid
);
int32_t
tableListGetGroupList
(
const
STableListInfo
*
pTableList
,
int32_t
ordinalIndex
,
STableKeyInfo
**
pKeyInfo
,
int32_t
*
num
);
int32_t
tableListGetGroupList
(
const
STableListInfo
*
pTableList
,
int32_t
ordinalIndex
,
STableKeyInfo
**
pKeyInfo
,
uint64_t
tableListGetSize
(
const
STableListInfo
*
pTableList
);
int32_t
*
num
);
uint64_t
tableListGetSuid
(
const
STableListInfo
*
pTableList
);
uint64_t
tableListGetSize
(
const
STableListInfo
*
pTableList
);
STableKeyInfo
*
tableListGetInfo
(
const
STableListInfo
*
pTableList
,
int32_t
index
);
uint64_t
tableListGetSuid
(
const
STableListInfo
*
pTableList
);
STableKeyInfo
*
tableListGetInfo
(
const
STableListInfo
*
pTableList
,
int32_t
index
);
size_t
getResultRowSize
(
struct
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
size_t
getResultRowSize
(
struct
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
void
initResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
);
void
initResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
);
...
@@ -140,7 +132,7 @@ bool hasRemainResults(SGroupResInfo* pGroupResInfo);
...
@@ -140,7 +132,7 @@ bool hasRemainResults(SGroupResInfo* pGroupResInfo);
int32_t
getNumOfTotalRes
(
SGroupResInfo
*
pGroupResInfo
);
int32_t
getNumOfTotalRes
(
SGroupResInfo
*
pGroupResInfo
);
SSDataBlock
*
create
ResDataBlock
(
SDataBlockDescNode
*
pNode
);
SSDataBlock
*
create
DataBlockFromDescNode
(
SDataBlockDescNode
*
pNode
);
EDealRes
doTranslateTagExpr
(
SNode
**
pNode
,
void
*
pContext
);
EDealRes
doTranslateTagExpr
(
SNode
**
pNode
,
void
*
pContext
);
int32_t
getGroupIdFromTagsVal
(
void
*
pMeta
,
uint64_t
uid
,
SNodeList
*
pGroupNode
,
char
*
keyBuf
,
uint64_t
*
pGroupId
);
int32_t
getGroupIdFromTagsVal
(
void
*
pMeta
,
uint64_t
uid
,
SNodeList
*
pGroupNode
,
char
*
keyBuf
,
uint64_t
*
pGroupId
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
682b3b60
...
@@ -537,15 +537,6 @@ typedef struct SStreamIntervalOperatorInfo {
...
@@ -537,15 +537,6 @@ typedef struct SStreamIntervalOperatorInfo {
SWinKey
delKey
;
SWinKey
delKey
;
}
SStreamIntervalOperatorInfo
;
}
SStreamIntervalOperatorInfo
;
typedef
struct
SAggOperatorInfo
{
SOptrBasicInfo
binfo
;
SAggSupporter
aggSup
;
STableQueryInfo
*
current
;
uint64_t
groupId
;
SGroupResInfo
groupResInfo
;
SExprSupp
scalarExprSup
;
}
SAggOperatorInfo
;
typedef
struct
SFillOperatorInfo
{
typedef
struct
SFillOperatorInfo
{
struct
SFillInfo
*
pFillInfo
;
struct
SFillInfo
*
pFillInfo
;
SSDataBlock
*
pRes
;
SSDataBlock
*
pRes
;
...
@@ -577,18 +568,6 @@ typedef struct SWindowRowsSup {
...
@@ -577,18 +568,6 @@ typedef struct SWindowRowsSup {
uint64_t
groupId
;
uint64_t
groupId
;
}
SWindowRowsSup
;
}
SWindowRowsSup
;
typedef
struct
SSessionAggOperatorInfo
{
SOptrBasicInfo
binfo
;
SAggSupporter
aggSup
;
SGroupResInfo
groupResInfo
;
SWindowRowsSup
winSup
;
bool
reptScan
;
// next round scan
int64_t
gap
;
// session window gap
int32_t
tsSlotId
;
// primary timestamp slot id
STimeWindowAggSupp
twAggSup
;
}
SSessionAggOperatorInfo
;
typedef
struct
SResultWindowInfo
{
typedef
struct
SResultWindowInfo
{
void
*
pOutputBuf
;
void
*
pOutputBuf
;
SSessionKey
sessionWin
;
SSessionKey
sessionWin
;
...
@@ -681,53 +660,30 @@ typedef struct SStreamFillOperatorInfo {
...
@@ -681,53 +660,30 @@ typedef struct SStreamFillOperatorInfo {
SStreamFillInfo
*
pFillInfo
;
SStreamFillInfo
*
pFillInfo
;
}
SStreamFillOperatorInfo
;
}
SStreamFillOperatorInfo
;
typedef
struct
STimeSliceOperatorInfo
{
SSDataBlock
*
pRes
;
STimeWindow
win
;
SInterval
interval
;
int64_t
current
;
SArray
*
pPrevRow
;
// SArray<SGroupValue>
SArray
*
pNextRow
;
// SArray<SGroupValue>
SArray
*
pLinearInfo
;
// SArray<SFillLinearInfo>
bool
isPrevRowSet
;
bool
isNextRowSet
;
int32_t
fillType
;
// fill type
SColumn
tsCol
;
// primary timestamp column
SExprSupp
scalarSup
;
// scalar calculation
struct
SFillColInfo
*
pFillColInfo
;
// fill column info
}
STimeSliceOperatorInfo
;
typedef
struct
SStateWindowOperatorInfo
{
// SOptrBasicInfo should be first, SAggSupporter should be second for stream encode
SOptrBasicInfo
binfo
;
SAggSupporter
aggSup
;
SExprSupp
scalarSup
;
SGroupResInfo
groupResInfo
;
SWindowRowsSup
winSup
;
SColumn
stateCol
;
// start row index
bool
hasKey
;
SStateKeys
stateKey
;
int32_t
tsSlotId
;
// primary timestamp column slot id
STimeWindowAggSupp
twAggSup
;
}
SStateWindowOperatorInfo
;
#define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED)
#define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED)
#define OPTR_SET_OPENED(_optr) ((_optr)->status |= OP_OPENED)
#define OPTR_SET_OPENED(_optr) ((_optr)->status |= OP_OPENED)
SOperatorFpSet
createOperatorFpSet
(
__optr_open_fn_t
openFn
,
__optr_fn_t
nextFn
,
__optr_fn_t
cleanup
,
SOperatorFpSet
createOperatorFpSet
(
__optr_open_fn_t
openFn
,
__optr_fn_t
nextFn
,
__optr_fn_t
cleanup
,
__optr_close_fn_t
closeFn
,
__optr_explain_fn_t
explain
);
__optr_close_fn_t
closeFn
,
__optr_explain_fn_t
explain
);
int32_t
operatorDummyOpenFn
(
SOperatorInfo
*
pOperator
);
int32_t
operatorDummyOpenFn
(
SOperatorInfo
*
pOperator
);
int32_t
appendDownstream
(
SOperatorInfo
*
p
,
SOperatorInfo
**
pDownstream
,
int32_t
num
);
int32_t
appendDownstream
(
SOperatorInfo
*
p
,
SOperatorInfo
**
pDownstream
,
int32_t
num
);
void
setOperatorCompleted
(
SOperatorInfo
*
pOperator
);
void
setOperatorInfo
(
SOperatorInfo
*
pOperator
,
const
char
*
name
,
int32_t
type
,
bool
blocking
,
int32_t
status
,
void
*
pInfo
,
SExecTaskInfo
*
pTaskInfo
);
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
);
void
initBasicInfo
(
SOptrBasicInfo
*
pInfo
,
SSDataBlock
*
pBlock
);
void
initBasicInfo
(
SOptrBasicInfo
*
pInfo
,
SSDataBlock
*
pBlock
);
void
cleanupBasicInfo
(
SOptrBasicInfo
*
pInfo
);
void
cleanupBasicInfo
(
SOptrBasicInfo
*
pInfo
);
int32_t
initExprSupp
(
SExprSupp
*
pSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfExpr
);
int32_t
initExprSupp
(
SExprSupp
*
pSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfExpr
);
void
cleanupExprSupp
(
SExprSupp
*
pSup
);
void
cleanupExprSupp
(
SExprSupp
*
pSup
);
void
destroyExprInfo
(
SExprInfo
*
pExpr
,
int32_t
numOfExprs
);
void
destroyExprInfo
(
SExprInfo
*
pExpr
,
int32_t
numOfExprs
);
int32_t
initAggInfo
(
SExprSupp
*
pSup
,
SAggSupporter
*
pAggSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
size_t
keyBufSize
,
const
char
*
pkey
);
int32_t
initAggSup
(
SExprSupp
*
pSup
,
SAggSupporter
*
pAggSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
size_t
keyBufSize
,
const
char
*
pkey
);
void
cleanupAggSup
(
SAggSupporter
*
pAggSup
);
void
initResultSizeInfo
(
SResultInfo
*
pResultInfo
,
int32_t
numOfRows
);
void
initResultSizeInfo
(
SResultInfo
*
pResultInfo
,
int32_t
numOfRows
);
void
doBuildStreamResBlock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
void
doBuildStreamResBlock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
...
@@ -735,12 +691,12 @@ void doBuildStreamResBlock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGr
...
@@ -735,12 +691,12 @@ void doBuildStreamResBlock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGr
void
doBuildResultDatablock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
void
doBuildResultDatablock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
);
SDiskbasedBuf
*
pBuf
);
bool
hasLimitOffsetInfo
(
SLimitInfo
*
pLimitInfo
);
bool
hasLimitOffsetInfo
(
SLimitInfo
*
pLimitInfo
);
void
initLimitInfo
(
const
SNode
*
pLimit
,
const
SNode
*
pSLimit
,
SLimitInfo
*
pLimitInfo
);
void
initLimitInfo
(
const
SNode
*
pLimit
,
const
SNode
*
pSLimit
,
SLimitInfo
*
pLimitInfo
);
void
applyLimitOffset
(
SLimitInfo
*
pLimitInfo
,
SSDataBlock
*
pBlock
,
SExecTaskInfo
*
pTaskInfo
,
SOperatorInfo
*
pOperator
);
void
applyLimitOffset
(
SLimitInfo
*
pLimitInfo
,
SSDataBlock
*
pBlock
,
SExecTaskInfo
*
pTaskInfo
,
SOperatorInfo
*
pOperator
);
void
doApplyFunctions
(
SExecTaskInfo
*
taskInfo
,
SqlFunctionCtx
*
pCtx
,
SColumnInfoData
*
pTimeWindowData
,
int32_t
offset
,
void
applyAggFunctionOnPartialTuples
(
SExecTaskInfo
*
taskInfo
,
SqlFunctionCtx
*
pCtx
,
SColumnInfoData
*
pTimeWindowData
,
int32_t
forwardStep
,
int32_t
numOfTotal
,
int32_t
numOfOutput
);
int32_t
offset
,
int32_t
forwardStep
,
int32_t
numOfTotal
,
int32_t
numOfOutput
);
int32_t
extractDataBlockFromFetchRsp
(
SSDataBlock
*
pRes
,
char
*
pData
,
SArray
*
pColList
,
char
**
pNextStart
);
int32_t
extractDataBlockFromFetchRsp
(
SSDataBlock
*
pRes
,
char
*
pData
,
SArray
*
pColList
,
char
**
pNextStart
);
void
updateLoadRemoteInfo
(
SLoadRemoteDataInfo
*
pInfo
,
int32_t
numOfRows
,
int32_t
dataLen
,
int64_t
startTs
,
void
updateLoadRemoteInfo
(
SLoadRemoteDataInfo
*
pInfo
,
int32_t
numOfRows
,
int32_t
dataLen
,
int64_t
startTs
,
...
@@ -751,130 +707,108 @@ STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInter
...
@@ -751,130 +707,108 @@ STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInter
int32_t
getTableScanInfo
(
SOperatorInfo
*
pOperator
,
int32_t
*
order
,
int32_t
*
scanFlag
);
int32_t
getTableScanInfo
(
SOperatorInfo
*
pOperator
,
int32_t
*
order
,
int32_t
*
scanFlag
);
int32_t
getBufferPgSize
(
int32_t
rowSize
,
uint32_t
*
defaultPgsz
,
uint32_t
*
defaultBufsz
);
int32_t
getBufferPgSize
(
int32_t
rowSize
,
uint32_t
*
defaultPgsz
,
uint32_t
*
defaultBufsz
);
void
doDestroyExchangeOperatorInfo
(
void
*
param
);
extern
void
doDestroyExchangeOperatorInfo
(
void
*
param
);
void
setOperatorCompleted
(
SOperatorInfo
*
pOperator
);
void
setOperatorInfo
(
SOperatorInfo
*
pOperator
,
const
char
*
name
,
int32_t
type
,
bool
blocking
,
int32_t
status
,
void
*
pInfo
,
SExecTaskInfo
*
pTaskInfo
);
void
doFilter
(
SSDataBlock
*
pBlock
,
SFilterInfo
*
pFilterInfo
,
SColMatchInfo
*
pColMatchInfo
);
void
doFilter
(
SSDataBlock
*
pBlock
,
SFilterInfo
*
pFilterInfo
,
SColMatchInfo
*
pColMatchInfo
);
int32_t
addTagPseudoColumnData
(
SReadHandle
*
pHandle
,
const
SExprInfo
*
pExpr
,
int32_t
numOfExpr
,
SSDataBlock
*
pBlock
,
int32_t
addTagPseudoColumnData
(
SReadHandle
*
pHandle
,
const
SExprInfo
*
pExpr
,
int32_t
numOfExpr
,
SSDataBlock
*
pBlock
,
int32_t
rows
,
const
char
*
idStr
,
STableMetaCacheInfo
*
pCache
);
int32_t
rows
,
const
char
*
idStr
,
STableMetaCacheInfo
*
pCache
);
void
cleanupAggSup
(
SAggSupporter
*
pAggSup
);
void
appendOneRowToDataBlock
(
SSDataBlock
*
pBlock
,
STupleHandle
*
pTupleHandle
);
void
appendOneRowToDataBlock
(
SSDataBlock
*
pBlock
,
STupleHandle
*
pTupleHandle
);
void
setTbNameColData
(
const
SSDataBlock
*
pBlock
,
SColumnInfoData
*
pColInfoData
,
int32_t
functionId
,
const
char
*
name
);
void
setTbNameColData
(
const
SSDataBlock
*
pBlock
,
SColumnInfoData
*
pColInfoData
,
int32_t
functionId
,
const
char
*
name
);
SSDataBlock
*
loadNextDataBlock
(
void
*
param
);
void
setResultRowInitCtx
(
SResultRow
*
pResult
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
int32_t
*
rowEntryInfoOffset
);
void
setResultRowInitCtx
(
SResultRow
*
pResult
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
int32_t
*
rowEntryInfoOffset
);
SResultRow
*
doSetResultOutBufByKey
(
SDiskbasedBuf
*
pResultBuf
,
SResultRowInfo
*
pResultRowInfo
,
char
*
pData
,
SResultRow
*
doSetResultOutBufByKey
(
SDiskbasedBuf
*
pResultBuf
,
SResultRowInfo
*
pResultRowInfo
,
char
*
pData
,
int16_t
bytes
,
bool
masterscan
,
uint64_t
groupId
,
SExecTaskInfo
*
pTaskInfo
,
int16_t
bytes
,
bool
masterscan
,
uint64_t
groupId
,
SExecTaskInfo
*
pTaskInfo
,
bool
isIntervalQuery
,
SAggSupporter
*
pSup
);
bool
isIntervalQuery
,
SAggSupporter
*
pSup
);
// operator creater functions
// clang-format off
SOperatorInfo
*
createExchangeOperatorInfo
(
void
*
pTransporter
,
SExchangePhysiNode
*
pExNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createExchangeOperatorInfo
(
void
*
pTransporter
,
SExchangePhysiNode
*
pExNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTableScanOperatorInfo
(
STableScanPhysiNode
*
pTableScanNode
,
SReadHandle
*
pHandle
,
SOperatorInfo
*
createTableScanOperatorInfo
(
STableScanPhysiNode
*
pTableScanNode
,
SReadHandle
*
pHandle
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTagScanOperatorInfo
(
SReadHandle
*
pReadHandle
,
STagScanPhysiNode
*
pPhyNode
,
SOperatorInfo
*
createTableMergeScanOperatorInfo
(
STableScanPhysiNode
*
pTableScanNode
,
SReadHandle
*
readHandle
,
SExecTaskInfo
*
pTaskInfo
);
STableListInfo
*
pTableListInfo
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createSysTableScanOperatorInfo
(
void
*
readHandle
,
SSystemTableScanPhysiNode
*
pScanPhyNode
,
SOperatorInfo
*
createTagScanOperatorInfo
(
SReadHandle
*
pReadHandle
,
STagScanPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
);
const
char
*
pUser
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createSysTableScanOperatorInfo
(
void
*
readHandle
,
SSystemTableScanPhysiNode
*
pScanPhyNode
,
const
char
*
pUser
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createAggregateOperatorInfo
(
SOperatorInfo
*
downstream
,
SAggPhysiNode
*
pNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createAggregateOperatorInfo
(
SOperatorInfo
*
downstream
,
SAggPhysiNode
*
pNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createIndefinitOutputOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pNode
,
SOperatorInfo
*
createIndefinitOutputOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createProjectOperatorInfo
(
SOperatorInfo
*
downstream
,
SProjectPhysiNode
*
pProjPhyNode
,
SOperatorInfo
*
createProjectOperatorInfo
(
SOperatorInfo
*
downstream
,
SProjectPhysiNode
*
pProjPhyNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createSortOperatorInfo
(
SOperatorInfo
*
downstream
,
SSortPhysiNode
*
pSortNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createSortOperatorInfo
(
SOperatorInfo
*
downstream
,
SSortPhysiNode
*
pSortNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createMultiwayMergeOperatorInfo
(
SOperatorInfo
**
dowStreams
,
size_t
numStreams
,
SMergePhysiNode
*
pMergePhysiNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createMultiwayMergeOperatorInfo
(
SOperatorInfo
**
dowStreams
,
size_t
numStreams
,
SMergePhysiNode
*
pMergePhysiNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createCacherowsScanOperator
(
SLastRowScanPhysiNode
*
pTableScanNode
,
SReadHandle
*
readHandle
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createCacherowsScanOperator
(
SLastRowScanPhysiNode
*
pTableScanNode
,
SReadHandle
*
readHandle
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SIntervalPhysiNode
*
pPhyNode
,
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SIntervalPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
,
bool
isStream
);
SExecTaskInfo
*
pTaskInfo
,
bool
isStream
);
SOperatorInfo
*
createMergeIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SMergeIntervalPhysiNode
*
pIntervalPhyNode
,
SOperatorInfo
*
createMergeIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SMergeIntervalPhysiNode
*
pIntervalPhyNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createMergeAlignedIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SMergeAlignedIntervalPhysiNode
*
pNode
,
SOperatorInfo
*
createMergeAlignedIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SMergeAlignedIntervalPhysiNode
*
pNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamFinalIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SOperatorInfo
*
createStreamFinalIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
,
int32_t
numOfChild
);
SExecTaskInfo
*
pTaskInfo
,
int32_t
numOfChild
);
SOperatorInfo
*
createSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SSessionWinodwPhysiNode
*
pSessionNode
,
SOperatorInfo
*
createSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SSessionWinodwPhysiNode
*
pSessionNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createGroupOperatorInfo
(
SOperatorInfo
*
downstream
,
SAggPhysiNode
*
pAggNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createGroupOperatorInfo
(
SOperatorInfo
*
downstream
,
SAggPhysiNode
*
pAggNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createDataBlockInfoScanOperator
(
SReadHandle
*
readHandle
,
SBlockDistScanPhysiNode
*
pBlockScanNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamScanOperatorInfo
(
SReadHandle
*
pHandle
,
STableScanPhysiNode
*
pTableScanNode
,
SNode
*
pTagCond
,
SOperatorInfo
*
createDataBlockInfoScanOperator
(
SReadHandle
*
readHandle
,
SBlockDistScanPhysiNode
*
pBlockScanNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamScanOperatorInfo
(
SReadHandle
*
pHandle
,
STableScanPhysiNode
*
pTableScanNode
,
SNode
*
pTagCond
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createRawScanOperatorInfo
(
SReadHandle
*
pHandle
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createRawScanOperatorInfo
(
SReadHandle
*
pHandle
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createFillOperatorInfo
(
SOperatorInfo
*
downstream
,
SFillPhysiNode
*
pPhyFillNode
,
SOperatorInfo
*
createFillOperatorInfo
(
SOperatorInfo
*
downstream
,
SFillPhysiNode
*
pPhyFillNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStatewindowOperatorInfo
(
SOperatorInfo
*
downstream
,
SStateWinodwPhysiNode
*
pStateNode
,
SOperatorInfo
*
createStatewindowOperatorInfo
(
SOperatorInfo
*
downstream
,
SStateWinodwPhysiNode
*
pStateNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createPartitionOperatorInfo
(
SOperatorInfo
*
downstream
,
SPartitionPhysiNode
*
pPartNode
,
SOperatorInfo
*
createPartitionOperatorInfo
(
SOperatorInfo
*
downstream
,
SPartitionPhysiNode
*
pPartNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamPartitionOperatorInfo
(
SOperatorInfo
*
downstream
,
SStreamPartitionPhysiNode
*
pPartNode
,
SOperatorInfo
*
createStreamPartitionOperatorInfo
(
SOperatorInfo
*
downstream
,
SStreamPartitionPhysiNode
*
pPartNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTimeSliceOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTimeSliceOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createMergeJoinOperatorInfo
(
SOperatorInfo
**
pDownstream
,
int32_t
numOfDownstream
,
SSortMergeJoinPhysiNode
*
pJoinNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SOperatorInfo
*
createMergeJoinOperatorInfo
(
SOperatorInfo
**
pDownstream
,
int32_t
numOfDownstream
,
SSortMergeJoinPhysiNode
*
pJoinNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamFinalSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SOperatorInfo
*
createStreamSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
,
int32_t
numOfChild
);
SOperatorInfo
*
createStreamIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SOperatorInfo
*
createStreamFinalSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
,
int32_t
numOfChild
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamStateAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SOperatorInfo
*
createStreamStateAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamFillOperatorInfo
(
SOperatorInfo
*
downstream
,
SStreamFillPhysiNode
*
pPhyFillNode
,
SOperatorInfo
*
createStreamFillOperatorInfo
(
SOperatorInfo
*
downstream
,
SStreamFillPhysiNode
*
pPhyFillNode
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createGroupSortOperatorInfo
(
SOperatorInfo
*
downstream
,
SGroupSortPhysiNode
*
pSortPhyNode
,
SExecTaskInfo
*
pTaskInfo
);
// clang-format on
int32_t
projectApplyFunctions
(
SExprInfo
*
pExpr
,
SSDataBlock
*
pResult
,
SSDataBlock
*
pSrcBlock
,
SqlFunctionCtx
*
pCtx
,
int32_t
projectApplyFunctions
(
SExprInfo
*
pExpr
,
SSDataBlock
*
pResult
,
SSDataBlock
*
pSrcBlock
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
SArray
*
pPseudoList
);
int32_t
numOfOutput
,
SArray
*
pPseudoList
);
void
setInputDataBlock
(
SExprSupp
*
pExprSupp
,
SSDataBlock
*
pBlock
,
int32_t
order
,
int32_t
scanFlag
,
bool
createDummyCol
);
void
setInputDataBlock
(
SExprSupp
*
pExprSupp
,
SSDataBlock
*
pBlock
,
int32_t
order
,
int32_t
scanFlag
,
bool
createDummyCol
);
bool
isTaskKilled
(
SExecTaskInfo
*
pTaskInfo
);
int32_t
checkForQueryBuf
(
size_t
numOfTables
);
int32_t
checkForQueryBuf
(
size_t
numOfTables
);
bool
isTaskKilled
(
SExecTaskInfo
*
pTaskInfo
);
void
setTaskKilled
(
SExecTaskInfo
*
pTaskInfo
);
void
setTaskKilled
(
SExecTaskInfo
*
pTaskInfo
);
void
queryCostStatis
(
SExecTaskInfo
*
pTaskInfo
);
void
doDestroyTask
(
SExecTaskInfo
*
pTaskInfo
);
void
doDestroyTask
(
SExecTaskInfo
*
pTaskInfo
);
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
);
int32_t
getMaximumIdleDurationSec
();
/*
* ops: root operator
* data: *data save the result of encode, need to be freed by caller
* length: *length save the length of *data
* nOptrWithVal: *nOptrWithVal save the number of optr with value
* return: result code, 0 means success
*/
int32_t
encodeOperator
(
SOperatorInfo
*
ops
,
char
**
data
,
int32_t
*
length
,
int32_t
*
nOptrWithVal
);
/*
* ops: root operator, created by caller
* data: save the result of decode
* length: the length of data
* return: result code, 0 means success
*/
int32_t
decodeOperator
(
SOperatorInfo
*
ops
,
const
char
*
data
,
int32_t
length
);
void
setTaskStatus
(
SExecTaskInfo
*
pTaskInfo
,
int8_t
status
);
void
setTaskStatus
(
SExecTaskInfo
*
pTaskInfo
,
int8_t
status
);
int32_t
createExecTaskInfoImpl
(
SSubplan
*
pPlan
,
SExecTaskInfo
**
pTaskInfo
,
SReadHandle
*
pHandle
,
uint64_t
taskId
,
int32_t
createExecTaskInfoImpl
(
SSubplan
*
pPlan
,
SExecTaskInfo
**
pTaskInfo
,
SReadHandle
*
pHandle
,
uint64_t
taskId
,
char
*
sql
,
EOPTR_EXEC_MODEL
model
);
char
*
sql
,
EOPTR_EXEC_MODEL
model
);
int32_t
createDataSinkParam
(
SDataSinkNode
*
pNode
,
void
**
pParam
,
qTaskInfo_t
*
pTaskInfo
,
SReadHandle
*
readHandle
);
int32_t
createDataSinkParam
(
SDataSinkNode
*
pNode
,
void
**
pParam
,
qTaskInfo_t
*
pTaskInfo
,
SReadHandle
*
readHandle
);
int32_t
getOperatorExplainExecInfo
(
SOperatorInfo
*
operatorInfo
,
SArray
*
pExecInfoList
);
int32_t
getOperatorExplainExecInfo
(
SOperatorInfo
*
operatorInfo
,
SArray
*
pExecInfoList
);
void
printTaskExecCostInLog
(
SExecTaskInfo
*
pTaskInfo
);
int32_t
getMaximumIdleDurationSec
();
STimeWindow
getActiveTimeWindow
(
SDiskbasedBuf
*
pBuf
,
SResultRowInfo
*
pResultRowInfo
,
int64_t
ts
,
SInterval
*
pInterval
,
STimeWindow
getActiveTimeWindow
(
SDiskbasedBuf
*
pBuf
,
SResultRowInfo
*
pResultRowInfo
,
int64_t
ts
,
SInterval
*
pInterval
,
int32_t
order
);
int32_t
order
);
int32_t
getNumOfRowsInTimeWindow
(
SDataBlockInfo
*
pDataBlockInfo
,
TSKEY
*
pPrimaryColumn
,
int32_t
startPos
,
TSKEY
ekey
,
int32_t
getNumOfRowsInTimeWindow
(
SDataBlockInfo
*
pDataBlockInfo
,
TSKEY
*
pPrimaryColumn
,
int32_t
startPos
,
TSKEY
ekey
,
...
@@ -897,15 +831,7 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock);
...
@@ -897,15 +831,7 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock);
int32_t
finalizeResultRows
(
SDiskbasedBuf
*
pBuf
,
SResultRowPosition
*
resultRowPosition
,
SExprSupp
*
pSup
,
int32_t
finalizeResultRows
(
SDiskbasedBuf
*
pBuf
,
SResultRowPosition
*
resultRowPosition
,
SExprSupp
*
pSup
,
SSDataBlock
*
pBlock
,
SExecTaskInfo
*
pTaskInfo
);
SSDataBlock
*
pBlock
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createGroupSortOperatorInfo
(
SOperatorInfo
*
downstream
,
SGroupSortPhysiNode
*
pSortPhyNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTableMergeScanOperatorInfo
(
STableScanPhysiNode
*
pTableScanNode
,
SReadHandle
*
readHandle
,
SExecTaskInfo
*
pTaskInfo
);
void
copyUpdateDataBlock
(
SSDataBlock
*
pDest
,
SSDataBlock
*
pSource
,
int32_t
tsColIndex
);
bool
groupbyTbname
(
SNodeList
*
pGroupList
);
bool
groupbyTbname
(
SNodeList
*
pGroupList
);
void
*
destroySqlFunctionCtx
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
int32_t
buildDataBlockFromGroupRes
(
SOperatorInfo
*
pOperator
,
SStreamState
*
pState
,
SSDataBlock
*
pBlock
,
SExprSupp
*
pSup
,
int32_t
buildDataBlockFromGroupRes
(
SOperatorInfo
*
pOperator
,
SStreamState
*
pState
,
SSDataBlock
*
pBlock
,
SExprSupp
*
pSup
,
SGroupResInfo
*
pGroupResInfo
);
SGroupResInfo
*
pGroupResInfo
);
int32_t
saveSessionDiscBuf
(
SStreamState
*
pState
,
SSessionKey
*
key
,
void
*
buf
,
int32_t
size
);
int32_t
saveSessionDiscBuf
(
SStreamState
*
pState
,
SSessionKey
*
key
,
void
*
buf
,
int32_t
size
);
...
...
source/libs/executor/src/cachescanoperator.c
浏览文件 @
682b3b60
...
@@ -59,7 +59,7 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe
...
@@ -59,7 +59,7 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe
pInfo
->
readHandle
=
*
readHandle
;
pInfo
->
readHandle
=
*
readHandle
;
SDataBlockDescNode
*
pDescNode
=
pScanNode
->
scan
.
node
.
pOutputDataBlockDesc
;
SDataBlockDescNode
*
pDescNode
=
pScanNode
->
scan
.
node
.
pOutputDataBlockDesc
;
pInfo
->
pRes
=
create
ResDataBlock
(
pDescNode
);
pInfo
->
pRes
=
create
DataBlockFromDescNode
(
pDescNode
);
int32_t
numOfCols
=
0
;
int32_t
numOfCols
=
0
;
code
=
code
=
...
@@ -185,7 +185,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
...
@@ -185,7 +185,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
}
}
}
}
pRes
->
info
.
uid
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pInfo
->
pUidList
,
pInfo
->
indexOfBufferedRes
);
pRes
->
info
.
id
.
uid
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pInfo
->
pUidList
,
pInfo
->
indexOfBufferedRes
);
pRes
->
info
.
rows
=
1
;
pRes
->
info
.
rows
=
1
;
SExprSupp
*
pSup
=
&
pInfo
->
pseudoExprSup
;
SExprSupp
*
pSup
=
&
pInfo
->
pseudoExprSup
;
...
@@ -196,7 +196,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
...
@@ -196,7 +196,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
return
NULL
;
return
NULL
;
}
}
pRes
->
info
.
groupId
=
getTableGroupId
(
pTableList
,
pRes
->
info
.
uid
);
pRes
->
info
.
id
.
groupId
=
getTableGroupId
(
pTableList
,
pRes
->
info
.
id
.
uid
);
pInfo
->
indexOfBufferedRes
+=
1
;
pInfo
->
indexOfBufferedRes
+=
1
;
return
pRes
;
return
pRes
;
}
else
{
}
else
{
...
@@ -232,12 +232,12 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
...
@@ -232,12 +232,12 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
SExprSupp
*
pSup
=
&
pInfo
->
pseudoExprSup
;
SExprSupp
*
pSup
=
&
pInfo
->
pseudoExprSup
;
STableKeyInfo
*
pKeyInfo
=
&
((
STableKeyInfo
*
)
pList
)[
0
];
STableKeyInfo
*
pKeyInfo
=
&
((
STableKeyInfo
*
)
pList
)[
0
];
pInfo
->
pRes
->
info
.
groupId
=
pKeyInfo
->
groupId
;
pInfo
->
pRes
->
info
.
id
.
groupId
=
pKeyInfo
->
groupId
;
if
(
taosArrayGetSize
(
pInfo
->
pUidList
)
>
0
)
{
if
(
taosArrayGetSize
(
pInfo
->
pUidList
)
>
0
)
{
ASSERT
((
pInfo
->
retrieveType
&
CACHESCAN_RETRIEVE_LAST_ROW
)
==
CACHESCAN_RETRIEVE_LAST_ROW
);
ASSERT
((
pInfo
->
retrieveType
&
CACHESCAN_RETRIEVE_LAST_ROW
)
==
CACHESCAN_RETRIEVE_LAST_ROW
);
pInfo
->
pRes
->
info
.
uid
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pInfo
->
pUidList
,
0
);
pInfo
->
pRes
->
info
.
id
.
uid
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pInfo
->
pUidList
,
0
);
code
=
addTagPseudoColumnData
(
&
pInfo
->
readHandle
,
pSup
->
pExprInfo
,
pSup
->
numOfExprs
,
pInfo
->
pRes
,
pInfo
->
pRes
->
info
.
rows
,
code
=
addTagPseudoColumnData
(
&
pInfo
->
readHandle
,
pSup
->
pExprInfo
,
pSup
->
numOfExprs
,
pInfo
->
pRes
,
pInfo
->
pRes
->
info
.
rows
,
GET_TASKID
(
pTaskInfo
),
NULL
);
GET_TASKID
(
pTaskInfo
),
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/executor/src/exchangeoperator.c
浏览文件 @
682b3b60
...
@@ -303,7 +303,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
...
@@ -303,7 +303,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
}
}
tsem_init
(
&
pInfo
->
ready
,
0
,
0
);
tsem_init
(
&
pInfo
->
ready
,
0
,
0
);
pInfo
->
pDummyBlock
=
create
ResDataBlock
(
pExNode
->
node
.
pOutputDataBlockDesc
);
pInfo
->
pDummyBlock
=
create
DataBlockFromDescNode
(
pExNode
->
node
.
pOutputDataBlockDesc
);
pInfo
->
pResultBlockList
=
taosArrayInit
(
64
,
POINTER_BYTES
);
pInfo
->
pResultBlockList
=
taosArrayInit
(
64
,
POINTER_BYTES
);
pInfo
->
pRecycledBlocks
=
taosArrayInit
(
64
,
POINTER_BYTES
);
pInfo
->
pRecycledBlocks
=
taosArrayInit
(
64
,
POINTER_BYTES
);
...
@@ -717,10 +717,10 @@ int32_t prepareLoadRemoteData(SOperatorInfo* pOperator) {
...
@@ -717,10 +717,10 @@ int32_t prepareLoadRemoteData(SOperatorInfo* pOperator) {
int32_t
handleLimitOffset
(
SOperatorInfo
*
pOperator
,
SLimitInfo
*
pLimitInfo
,
SSDataBlock
*
pBlock
,
bool
holdDataInBuf
)
{
int32_t
handleLimitOffset
(
SOperatorInfo
*
pOperator
,
SLimitInfo
*
pLimitInfo
,
SSDataBlock
*
pBlock
,
bool
holdDataInBuf
)
{
if
(
pLimitInfo
->
remainGroupOffset
>
0
)
{
if
(
pLimitInfo
->
remainGroupOffset
>
0
)
{
if
(
pLimitInfo
->
currentGroupId
==
0
)
{
// it is the first group
if
(
pLimitInfo
->
currentGroupId
==
0
)
{
// it is the first group
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
groupId
;
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
id
.
groupId
;
blockDataCleanup
(
pBlock
);
blockDataCleanup
(
pBlock
);
return
PROJECT_RETRIEVE_CONTINUE
;
return
PROJECT_RETRIEVE_CONTINUE
;
}
else
if
(
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
groupId
)
{
}
else
if
(
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
id
.
groupId
)
{
// now it is the data from a new group
// now it is the data from a new group
pLimitInfo
->
remainGroupOffset
-=
1
;
pLimitInfo
->
remainGroupOffset
-=
1
;
...
@@ -732,11 +732,11 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
...
@@ -732,11 +732,11 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
}
}
// set current group id of the project operator
// set current group id of the project operator
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
groupId
;
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
id
.
groupId
;
}
}
// here check for a new group data, we need to handle the data of the previous group.
// here check for a new group data, we need to handle the data of the previous group.
if
(
pLimitInfo
->
currentGroupId
!=
0
&&
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
groupId
)
{
if
(
pLimitInfo
->
currentGroupId
!=
0
&&
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
id
.
groupId
)
{
pLimitInfo
->
numOfOutputGroups
+=
1
;
pLimitInfo
->
numOfOutputGroups
+=
1
;
if
((
pLimitInfo
->
slimit
.
limit
>
0
)
&&
(
pLimitInfo
->
slimit
.
limit
<=
pLimitInfo
->
numOfOutputGroups
))
{
if
((
pLimitInfo
->
slimit
.
limit
>
0
)
&&
(
pLimitInfo
->
slimit
.
limit
<=
pLimitInfo
->
numOfOutputGroups
))
{
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
...
@@ -758,7 +758,7 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
...
@@ -758,7 +758,7 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
// here we reach the start position, according to the limit/offset requirements.
// here we reach the start position, according to the limit/offset requirements.
// set current group id
// set current group id
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
groupId
;
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
id
.
groupId
;
if
(
pLimitInfo
->
remainOffset
>=
pBlock
->
info
.
rows
)
{
if
(
pLimitInfo
->
remainOffset
>=
pBlock
->
info
.
rows
)
{
pLimitInfo
->
remainOffset
-=
pBlock
->
info
.
rows
;
pLimitInfo
->
remainOffset
-=
pBlock
->
info
.
rows
;
...
...
source/libs/executor/src/executil.c
浏览文件 @
682b3b60
...
@@ -208,12 +208,12 @@ SArray* createSortInfo(SNodeList* pNodeList) {
...
@@ -208,12 +208,12 @@ SArray* createSortInfo(SNodeList* pNodeList) {
return
pList
;
return
pList
;
}
}
SSDataBlock
*
create
ResDataBlock
(
SDataBlockDescNode
*
pNode
)
{
SSDataBlock
*
create
DataBlockFromDescNode
(
SDataBlockDescNode
*
pNode
)
{
int32_t
numOfCols
=
LIST_LENGTH
(
pNode
->
pSlots
);
int32_t
numOfCols
=
LIST_LENGTH
(
pNode
->
pSlots
);
SSDataBlock
*
pBlock
=
createDataBlock
();
SSDataBlock
*
pBlock
=
createDataBlock
();
pBlock
->
info
.
blockId
=
pNode
->
dataBlockId
;
pBlock
->
info
.
id
.
blockId
=
pNode
->
dataBlockId
;
pBlock
->
info
.
type
=
STREAM_INVALID
;
pBlock
->
info
.
type
=
STREAM_INVALID
;
pBlock
->
info
.
calWin
=
(
STimeWindow
){.
skey
=
INT64_MIN
,
.
ekey
=
INT64_MAX
};
pBlock
->
info
.
calWin
=
(
STimeWindow
){.
skey
=
INT64_MIN
,
.
ekey
=
INT64_MAX
};
pBlock
->
info
.
watermark
=
INT64_MIN
;
pBlock
->
info
.
watermark
=
INT64_MIN
;
...
...
source/libs/executor/src/executor.c
浏览文件 @
682b3b60
...
@@ -712,7 +712,7 @@ void qDestroyTask(qTaskInfo_t qTaskHandle) {
...
@@ -712,7 +712,7 @@ void qDestroyTask(qTaskInfo_t qTaskHandle) {
qDebug
(
"%s execTask completed, numOfRows:%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pTaskInfo
->
pRoot
->
resultInfo
.
totalRows
);
qDebug
(
"%s execTask completed, numOfRows:%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pTaskInfo
->
pRoot
->
resultInfo
.
totalRows
);
queryCostStatis
(
pTaskInfo
);
// print the query cost summary
printTaskExecCostInLog
(
pTaskInfo
);
// print the query cost summary
doDestroyTask
(
pTaskInfo
);
doDestroyTask
(
pTaskInfo
);
}
}
...
@@ -728,12 +728,12 @@ int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len) {
...
@@ -728,12 +728,12 @@ int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len) {
}
}
int32_t
nOptrWithVal
=
0
;
int32_t
nOptrWithVal
=
0
;
int32_t
code
=
encodeOperator
(
pTaskInfo
->
pRoot
,
pOutput
,
len
,
&
nOptrWithVal
);
//
int32_t code = encodeOperator(pTaskInfo->pRoot, pOutput, len, &nOptrWithVal);
if
((
code
==
TSDB_CODE_SUCCESS
)
&&
(
nOptrWithVal
==
0
))
{
//
if ((code == TSDB_CODE_SUCCESS) && (nOptrWithVal == 0)) {
taosMemoryFreeClear
(
*
pOutput
);
//
taosMemoryFreeClear(*pOutput);
*
len
=
0
;
//
*len = 0;
}
//
}
return
code
;
return
0
;
}
}
int32_t
qDeserializeTaskStatus
(
qTaskInfo_t
tinfo
,
const
char
*
pInput
,
int32_t
len
)
{
int32_t
qDeserializeTaskStatus
(
qTaskInfo_t
tinfo
,
const
char
*
pInput
,
int32_t
len
)
{
...
@@ -743,7 +743,8 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le
...
@@ -743,7 +743,8 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le
return
TSDB_CODE_INVALID_PARA
;
return
TSDB_CODE_INVALID_PARA
;
}
}
return
decodeOperator
(
pTaskInfo
->
pRoot
,
pInput
,
len
);
return
0
;
// return decodeOperator(pTaskInfo->pRoot, pInput, len);
}
}
int32_t
qExtractStreamScanner
(
qTaskInfo_t
tinfo
,
void
**
scanner
)
{
int32_t
qExtractStreamScanner
(
qTaskInfo_t
tinfo
,
void
**
scanner
)
{
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
682b3b60
此差异已折叠。
点击以展开。
source/libs/executor/src/groupoperator.c
浏览文件 @
682b3b60
...
@@ -308,13 +308,13 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
...
@@ -308,13 +308,13 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
len
=
buildGroupKeys
(
pInfo
->
keyBuf
,
pInfo
->
pGroupColVals
);
len
=
buildGroupKeys
(
pInfo
->
keyBuf
,
pInfo
->
pGroupColVals
);
int32_t
ret
=
setGroupResultOutputBuf
(
pOperator
,
&
(
pInfo
->
binfo
),
pOperator
->
exprSupp
.
numOfExprs
,
pInfo
->
keyBuf
,
int32_t
ret
=
setGroupResultOutputBuf
(
pOperator
,
&
(
pInfo
->
binfo
),
pOperator
->
exprSupp
.
numOfExprs
,
pInfo
->
keyBuf
,
len
,
pBlock
->
info
.
groupId
,
pInfo
->
aggSup
.
pResultBuf
,
&
pInfo
->
aggSup
);
len
,
pBlock
->
info
.
id
.
groupId
,
pInfo
->
aggSup
.
pResultBuf
,
&
pInfo
->
aggSup
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
// null data, too many state code
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
// null data, too many state code
T_LONG_JMP
(
pTaskInfo
->
env
,
TSDB_CODE_QRY_APP_ERROR
);
T_LONG_JMP
(
pTaskInfo
->
env
,
TSDB_CODE_QRY_APP_ERROR
);
}
}
int32_t
rowIndex
=
j
-
num
;
int32_t
rowIndex
=
j
-
num
;
doApplyFunction
s
(
pTaskInfo
,
pCtx
,
NULL
,
rowIndex
,
num
,
pBlock
->
info
.
rows
,
pOperator
->
exprSupp
.
numOfExprs
);
applyAggFunctionOnPartialTuple
s
(
pTaskInfo
,
pCtx
,
NULL
,
rowIndex
,
num
,
pBlock
->
info
.
rows
,
pOperator
->
exprSupp
.
numOfExprs
);
// assign the group keys or user input constant values if required
// assign the group keys or user input constant values if required
doAssignGroupKeys
(
pCtx
,
pOperator
->
exprSupp
.
numOfExprs
,
pBlock
->
info
.
rows
,
rowIndex
);
doAssignGroupKeys
(
pCtx
,
pOperator
->
exprSupp
.
numOfExprs
,
pBlock
->
info
.
rows
,
rowIndex
);
...
@@ -325,13 +325,13 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
...
@@ -325,13 +325,13 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
if
(
num
>
0
)
{
if
(
num
>
0
)
{
len
=
buildGroupKeys
(
pInfo
->
keyBuf
,
pInfo
->
pGroupColVals
);
len
=
buildGroupKeys
(
pInfo
->
keyBuf
,
pInfo
->
pGroupColVals
);
int32_t
ret
=
setGroupResultOutputBuf
(
pOperator
,
&
(
pInfo
->
binfo
),
pOperator
->
exprSupp
.
numOfExprs
,
pInfo
->
keyBuf
,
int32_t
ret
=
setGroupResultOutputBuf
(
pOperator
,
&
(
pInfo
->
binfo
),
pOperator
->
exprSupp
.
numOfExprs
,
pInfo
->
keyBuf
,
len
,
pBlock
->
info
.
groupId
,
pInfo
->
aggSup
.
pResultBuf
,
&
pInfo
->
aggSup
);
len
,
pBlock
->
info
.
id
.
groupId
,
pInfo
->
aggSup
.
pResultBuf
,
&
pInfo
->
aggSup
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
TSDB_CODE_QRY_APP_ERROR
);
T_LONG_JMP
(
pTaskInfo
->
env
,
TSDB_CODE_QRY_APP_ERROR
);
}
}
int32_t
rowIndex
=
pBlock
->
info
.
rows
-
num
;
int32_t
rowIndex
=
pBlock
->
info
.
rows
-
num
;
doApplyFunction
s
(
pTaskInfo
,
pCtx
,
NULL
,
rowIndex
,
num
,
pBlock
->
info
.
rows
,
pOperator
->
exprSupp
.
numOfExprs
);
applyAggFunctionOnPartialTuple
s
(
pTaskInfo
,
pCtx
,
NULL
,
rowIndex
,
num
,
pBlock
->
info
.
rows
,
pOperator
->
exprSupp
.
numOfExprs
);
doAssignGroupKeys
(
pCtx
,
pOperator
->
exprSupp
.
numOfExprs
,
pBlock
->
info
.
rows
,
rowIndex
);
doAssignGroupKeys
(
pCtx
,
pOperator
->
exprSupp
.
numOfExprs
,
pBlock
->
info
.
rows
,
rowIndex
);
}
}
}
}
...
@@ -431,7 +431,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode*
...
@@ -431,7 +431,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode*
goto
_error
;
goto
_error
;
}
}
SSDataBlock
*
pResBlock
=
create
ResDataBlock
(
pAggNode
->
node
.
pOutputDataBlockDesc
);
SSDataBlock
*
pResBlock
=
create
DataBlockFromDescNode
(
pAggNode
->
node
.
pOutputDataBlockDesc
);
initBasicInfo
(
&
pInfo
->
binfo
,
pResBlock
);
initBasicInfo
(
&
pInfo
->
binfo
,
pResBlock
);
int32_t
numOfScalarExpr
=
0
;
int32_t
numOfScalarExpr
=
0
;
...
@@ -456,7 +456,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode*
...
@@ -456,7 +456,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode*
int32_t
num
=
0
;
int32_t
num
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pAggNode
->
pAggFuncs
,
pAggNode
->
pGroupKeys
,
&
num
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pAggNode
->
pAggFuncs
,
pAggNode
->
pGroupKeys
,
&
num
);
code
=
initAgg
Info
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
num
,
pInfo
->
groupKeyLen
,
pTaskInfo
->
id
.
str
);
code
=
initAgg
Sup
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
num
,
pInfo
->
groupKeyLen
,
pTaskInfo
->
id
.
str
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
...
@@ -697,7 +697,7 @@ static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) {
...
@@ -697,7 +697,7 @@ static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) {
releaseBufPage
(
pInfo
->
pBuf
,
page
);
releaseBufPage
(
pInfo
->
pBuf
,
page
);
blockDataUpdateTsWindow
(
pInfo
->
binfo
.
pRes
,
0
);
blockDataUpdateTsWindow
(
pInfo
->
binfo
.
pRes
,
0
);
pInfo
->
binfo
.
pRes
->
info
.
groupId
=
pGroupInfo
->
groupId
;
pInfo
->
binfo
.
pRes
->
info
.
id
.
groupId
=
pGroupInfo
->
groupId
;
pOperator
->
resultInfo
.
totalRows
+=
pInfo
->
binfo
.
pRes
->
info
.
rows
;
pOperator
->
resultInfo
.
totalRows
+=
pInfo
->
binfo
.
pRes
->
info
.
rows
;
return
pInfo
->
binfo
.
pRes
;
return
pInfo
->
binfo
.
pRes
;
...
@@ -823,7 +823,7 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
...
@@ -823,7 +823,7 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
uint32_t
defaultPgsz
=
0
;
uint32_t
defaultPgsz
=
0
;
uint32_t
defaultBufsz
=
0
;
uint32_t
defaultBufsz
=
0
;
pInfo
->
binfo
.
pRes
=
create
ResDataBlock
(
pPartNode
->
node
.
pOutputDataBlockDesc
);
pInfo
->
binfo
.
pRes
=
create
DataBlockFromDescNode
(
pPartNode
->
node
.
pOutputDataBlockDesc
);
getBufferPgSize
(
pInfo
->
binfo
.
pRes
->
info
.
rowSize
,
&
defaultPgsz
,
&
defaultBufsz
);
getBufferPgSize
(
pInfo
->
binfo
.
pRes
->
info
.
rowSize
,
&
defaultPgsz
,
&
defaultBufsz
);
if
(
!
osTempSpaceAvailable
())
{
if
(
!
osTempSpaceAvailable
())
{
...
@@ -952,7 +952,7 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
...
@@ -952,7 +952,7 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
taosArrayDestroy
(
pParInfo
->
rowIds
);
taosArrayDestroy
(
pParInfo
->
rowIds
);
pParInfo
->
rowIds
=
NULL
;
pParInfo
->
rowIds
=
NULL
;
blockDataUpdateTsWindow
(
pDest
,
pInfo
->
tsColIndex
);
blockDataUpdateTsWindow
(
pDest
,
pInfo
->
tsColIndex
);
pDest
->
info
.
groupId
=
pParInfo
->
groupId
;
pDest
->
info
.
id
.
groupId
=
pParInfo
->
groupId
;
pOperator
->
resultInfo
.
totalRows
+=
pDest
->
info
.
rows
;
pOperator
->
resultInfo
.
totalRows
+=
pDest
->
info
.
rows
;
pInfo
->
parIte
=
taosHashIterate
(
pInfo
->
pPartitions
,
pInfo
->
parIte
);
pInfo
->
parIte
=
taosHashIterate
(
pInfo
->
pPartitions
,
pInfo
->
parIte
);
ASSERT
(
pDest
->
info
.
rows
>
0
);
ASSERT
(
pDest
->
info
.
rows
>
0
);
...
@@ -1119,7 +1119,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr
...
@@ -1119,7 +1119,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr
}
}
pInfo
->
partitionSup
.
needCalc
=
true
;
pInfo
->
partitionSup
.
needCalc
=
true
;
pInfo
->
binfo
.
pRes
=
create
ResDataBlock
(
pPartNode
->
part
.
node
.
pOutputDataBlockDesc
);
pInfo
->
binfo
.
pRes
=
create
DataBlockFromDescNode
(
pPartNode
->
part
.
node
.
pOutputDataBlockDesc
);
if
(
pInfo
->
binfo
.
pRes
==
NULL
)
{
if
(
pInfo
->
binfo
.
pRes
==
NULL
)
{
goto
_error
;
goto
_error
;
}
}
...
...
source/libs/executor/src/joinoperator.c
浏览文件 @
682b3b60
...
@@ -87,7 +87,7 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t
...
@@ -87,7 +87,7 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t
}
}
int32_t
numOfCols
=
0
;
int32_t
numOfCols
=
0
;
SSDataBlock
*
pResBlock
=
create
ResDataBlock
(
pJoinNode
->
node
.
pOutputDataBlockDesc
);
SSDataBlock
*
pResBlock
=
create
DataBlockFromDescNode
(
pJoinNode
->
node
.
pOutputDataBlockDesc
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pJoinNode
->
pTargets
,
NULL
,
&
numOfCols
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pJoinNode
->
pTargets
,
NULL
,
&
numOfCols
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
...
@@ -185,7 +185,7 @@ static void mergeJoinJoinLeftRight(struct SOperatorInfo* pOperator, SSDataBlock*
...
@@ -185,7 +185,7 @@ static void mergeJoinJoinLeftRight(struct SOperatorInfo* pOperator, SSDataBlock*
int32_t
rowIndex
=
-
1
;
int32_t
rowIndex
=
-
1
;
SColumnInfoData
*
pSrc
=
NULL
;
SColumnInfoData
*
pSrc
=
NULL
;
if
(
pLeftBlock
->
info
.
blockId
==
blockId
)
{
if
(
pLeftBlock
->
info
.
id
.
blockId
==
blockId
)
{
pSrc
=
taosArrayGet
(
pLeftBlock
->
pDataBlock
,
slotId
);
pSrc
=
taosArrayGet
(
pLeftBlock
->
pDataBlock
,
slotId
);
rowIndex
=
leftPos
;
rowIndex
=
leftPos
;
}
else
{
}
else
{
...
...
source/libs/executor/src/projectoperator.c
浏览文件 @
682b3b60
...
@@ -85,7 +85,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
...
@@ -85,7 +85,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
int32_t
numOfCols
=
0
;
int32_t
numOfCols
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pProjPhyNode
->
pProjections
,
NULL
,
&
numOfCols
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pProjPhyNode
->
pProjections
,
NULL
,
&
numOfCols
);
SSDataBlock
*
pResBlock
=
create
ResDataBlock
(
pProjPhyNode
->
node
.
pOutputDataBlockDesc
);
SSDataBlock
*
pResBlock
=
create
DataBlockFromDescNode
(
pProjPhyNode
->
node
.
pOutputDataBlockDesc
);
initLimitInfo
(
pProjPhyNode
->
node
.
pLimit
,
pProjPhyNode
->
node
.
pSlimit
,
&
pInfo
->
limitInfo
);
initLimitInfo
(
pProjPhyNode
->
node
.
pLimit
,
pProjPhyNode
->
node
.
pSlimit
,
&
pInfo
->
limitInfo
);
pInfo
->
binfo
.
pRes
=
pResBlock
;
pInfo
->
binfo
.
pRes
=
pResBlock
;
...
@@ -102,7 +102,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
...
@@ -102,7 +102,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
}
}
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
numOfRows
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
numOfRows
);
code
=
initAgg
Info
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
keyBufSize
,
pTaskInfo
->
id
.
str
);
code
=
initAgg
Sup
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
keyBufSize
,
pTaskInfo
->
id
.
str
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
...
@@ -138,13 +138,13 @@ _error:
...
@@ -138,13 +138,13 @@ _error:
static
int32_t
discardGroupDataBlock
(
SSDataBlock
*
pBlock
,
SLimitInfo
*
pLimitInfo
)
{
static
int32_t
discardGroupDataBlock
(
SSDataBlock
*
pBlock
,
SLimitInfo
*
pLimitInfo
)
{
if
(
pLimitInfo
->
remainGroupOffset
>
0
)
{
if
(
pLimitInfo
->
remainGroupOffset
>
0
)
{
// it is the first group
// it is the first group
if
(
pLimitInfo
->
currentGroupId
==
0
||
pLimitInfo
->
currentGroupId
==
pBlock
->
info
.
groupId
)
{
if
(
pLimitInfo
->
currentGroupId
==
0
||
pLimitInfo
->
currentGroupId
==
pBlock
->
info
.
id
.
groupId
)
{
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
groupId
;
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
id
.
groupId
;
return
PROJECT_RETRIEVE_CONTINUE
;
return
PROJECT_RETRIEVE_CONTINUE
;
}
else
if
(
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
groupId
)
{
}
else
if
(
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
id
.
groupId
)
{
// now it is the data from a new group
// now it is the data from a new group
pLimitInfo
->
remainGroupOffset
-=
1
;
pLimitInfo
->
remainGroupOffset
-=
1
;
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
groupId
;
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
id
.
groupId
;
// ignore data block in current group
// ignore data block in current group
if
(
pLimitInfo
->
remainGroupOffset
>
0
)
{
if
(
pLimitInfo
->
remainGroupOffset
>
0
)
{
...
@@ -153,7 +153,7 @@ static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo
...
@@ -153,7 +153,7 @@ static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo
}
}
// set current group id of the project operator
// set current group id of the project operator
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
groupId
;
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
id
.
groupId
;
}
}
return
PROJECT_RETRIEVE_DONE
;
return
PROJECT_RETRIEVE_DONE
;
...
@@ -164,7 +164,7 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S
...
@@ -164,7 +164,7 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S
// here check for a new group data, we need to handle the data of the previous group.
// here check for a new group data, we need to handle the data of the previous group.
ASSERT
(
pLimitInfo
->
remainGroupOffset
==
0
||
pLimitInfo
->
remainGroupOffset
==
-
1
);
ASSERT
(
pLimitInfo
->
remainGroupOffset
==
0
||
pLimitInfo
->
remainGroupOffset
==
-
1
);
if
(
pLimitInfo
->
currentGroupId
!=
0
&&
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
groupId
)
{
if
(
pLimitInfo
->
currentGroupId
!=
0
&&
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
id
.
groupId
)
{
pLimitInfo
->
numOfOutputGroups
+=
1
;
pLimitInfo
->
numOfOutputGroups
+=
1
;
if
((
pLimitInfo
->
slimit
.
limit
>
0
)
&&
(
pLimitInfo
->
slimit
.
limit
<=
pLimitInfo
->
numOfOutputGroups
))
{
if
((
pLimitInfo
->
slimit
.
limit
>
0
)
&&
(
pLimitInfo
->
slimit
.
limit
<=
pLimitInfo
->
numOfOutputGroups
))
{
setOperatorCompleted
(
pOperator
);
setOperatorCompleted
(
pOperator
);
...
@@ -306,7 +306,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
...
@@ -306,7 +306,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
}
}
status
=
doIngroupLimitOffset
(
pLimitInfo
,
pBlock
->
info
.
groupId
,
pInfo
->
pRes
,
pOperator
);
status
=
doIngroupLimitOffset
(
pLimitInfo
,
pBlock
->
info
.
id
.
groupId
,
pInfo
->
pRes
,
pOperator
);
if
(
status
==
PROJECT_RETRIEVE_CONTINUE
)
{
if
(
status
==
PROJECT_RETRIEVE_CONTINUE
)
{
continue
;
continue
;
}
}
...
@@ -316,7 +316,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
...
@@ -316,7 +316,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
if
(
pProjectInfo
->
mergeDataBlocks
)
{
if
(
pProjectInfo
->
mergeDataBlocks
)
{
if
(
pRes
->
info
.
rows
>
0
)
{
if
(
pRes
->
info
.
rows
>
0
)
{
pFinalRes
->
info
.
groupId
=
pRes
->
info
.
groupId
;
pFinalRes
->
info
.
id
.
groupId
=
pRes
->
info
.
id
.
groupId
;
pFinalRes
->
info
.
version
=
pRes
->
info
.
version
;
pFinalRes
->
info
.
version
=
pRes
->
info
.
version
;
// continue merge data, ignore the group id
// continue merge data, ignore the group id
...
@@ -385,7 +385,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
...
@@ -385,7 +385,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
}
}
}
}
SSDataBlock
*
pResBlock
=
create
ResDataBlock
(
pPhyNode
->
node
.
pOutputDataBlockDesc
);
SSDataBlock
*
pResBlock
=
create
DataBlockFromDescNode
(
pPhyNode
->
node
.
pOutputDataBlockDesc
);
int32_t
numOfRows
=
4096
;
int32_t
numOfRows
=
4096
;
size_t
keyBufSize
=
sizeof
(
int64_t
)
+
sizeof
(
int64_t
)
+
POINTER_BYTES
;
size_t
keyBufSize
=
sizeof
(
int64_t
)
+
sizeof
(
int64_t
)
+
POINTER_BYTES
;
...
@@ -400,7 +400,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
...
@@ -400,7 +400,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
numOfRows
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
numOfRows
);
blockDataEnsureCapacity
(
pResBlock
,
numOfRows
);
blockDataEnsureCapacity
(
pResBlock
,
numOfRows
);
int32_t
code
=
initAgg
Info
(
pSup
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfExpr
,
keyBufSize
,
pTaskInfo
->
id
.
str
);
int32_t
code
=
initAgg
Sup
(
pSup
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfExpr
,
keyBufSize
,
pTaskInfo
->
id
.
str
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
...
@@ -511,11 +511,11 @@ SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator) {
...
@@ -511,11 +511,11 @@ SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator) {
break
;
break
;
}
}
if
(
pIndefInfo
->
groupId
==
0
&&
pBlock
->
info
.
groupId
!=
0
)
{
if
(
pIndefInfo
->
groupId
==
0
&&
pBlock
->
info
.
id
.
groupId
!=
0
)
{
pIndefInfo
->
groupId
=
pBlock
->
info
.
groupId
;
// this is the initial group result
pIndefInfo
->
groupId
=
pBlock
->
info
.
id
.
groupId
;
// this is the initial group result
}
else
{
}
else
{
if
(
pIndefInfo
->
groupId
!=
pBlock
->
info
.
groupId
)
{
// reset output buffer and computing status
if
(
pIndefInfo
->
groupId
!=
pBlock
->
info
.
id
.
groupId
)
{
// reset output buffer and computing status
pIndefInfo
->
groupId
=
pBlock
->
info
.
groupId
;
pIndefInfo
->
groupId
=
pBlock
->
info
.
id
.
groupId
;
pIndefInfo
->
pNextGroupRes
=
pBlock
;
pIndefInfo
->
pNextGroupRes
=
pBlock
;
break
;
break
;
}
}
...
@@ -643,3 +643,182 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) {
...
@@ -643,3 +643,182 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) {
return
(
pRes
->
info
.
rows
>
0
)
?
pRes
:
NULL
;
return
(
pRes
->
info
.
rows
>
0
)
?
pRes
:
NULL
;
}
}
static
void
setPseudoOutputColInfo
(
SSDataBlock
*
pResult
,
SqlFunctionCtx
*
pCtx
,
SArray
*
pPseudoList
)
{
size_t
num
=
(
pPseudoList
!=
NULL
)
?
taosArrayGetSize
(
pPseudoList
)
:
0
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
pCtx
[
i
].
pOutput
=
taosArrayGet
(
pResult
->
pDataBlock
,
i
);
}
}
int32_t
projectApplyFunctions
(
SExprInfo
*
pExpr
,
SSDataBlock
*
pResult
,
SSDataBlock
*
pSrcBlock
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
SArray
*
pPseudoList
)
{
setPseudoOutputColInfo
(
pResult
,
pCtx
,
pPseudoList
);
if
(
pSrcBlock
==
NULL
)
{
for
(
int32_t
k
=
0
;
k
<
numOfOutput
;
++
k
)
{
int32_t
outputSlotId
=
pExpr
[
k
].
base
.
resSchema
.
slotId
;
ASSERT
(
pExpr
[
k
].
pExpr
->
nodeType
==
QUERY_NODE_VALUE
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
int32_t
type
=
pExpr
[
k
].
base
.
pParam
[
0
].
param
.
nType
;
if
(
TSDB_DATA_TYPE_NULL
==
type
)
{
colDataAppendNNULL
(
pColInfoData
,
0
,
1
);
}
else
{
colDataAppend
(
pColInfoData
,
0
,
taosVariantGet
(
&
pExpr
[
k
].
base
.
pParam
[
0
].
param
,
type
),
false
);
}
}
pResult
->
info
.
rows
=
1
;
return
TSDB_CODE_SUCCESS
;
}
if
(
pResult
!=
pSrcBlock
)
{
pResult
->
info
.
id
.
groupId
=
pSrcBlock
->
info
.
id
.
groupId
;
memcpy
(
pResult
->
info
.
parTbName
,
pSrcBlock
->
info
.
parTbName
,
TSDB_TABLE_NAME_LEN
);
}
// if the source equals to the destination, it is to create a new column as the result of scalar
// function or some operators.
bool
createNewColModel
=
(
pResult
==
pSrcBlock
);
if
(
createNewColModel
)
{
blockDataEnsureCapacity
(
pResult
,
pResult
->
info
.
rows
);
}
int32_t
numOfRows
=
0
;
for
(
int32_t
k
=
0
;
k
<
numOfOutput
;
++
k
)
{
int32_t
outputSlotId
=
pExpr
[
k
].
base
.
resSchema
.
slotId
;
SqlFunctionCtx
*
pfCtx
=
&
pCtx
[
k
];
SInputColumnInfoData
*
pInputData
=
&
pfCtx
->
input
;
if
(
pExpr
[
k
].
pExpr
->
nodeType
==
QUERY_NODE_COLUMN
)
{
// it is a project query
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
if
(
pResult
->
info
.
rows
>
0
&&
!
createNewColModel
)
{
colDataMergeCol
(
pColInfoData
,
pResult
->
info
.
rows
,
(
int32_t
*
)
&
pResult
->
info
.
capacity
,
pInputData
->
pData
[
0
],
pInputData
->
numOfRows
);
}
else
{
colDataAssign
(
pColInfoData
,
pInputData
->
pData
[
0
],
pInputData
->
numOfRows
,
&
pResult
->
info
);
}
numOfRows
=
pInputData
->
numOfRows
;
}
else
if
(
pExpr
[
k
].
pExpr
->
nodeType
==
QUERY_NODE_VALUE
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
int32_t
offset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
int32_t
type
=
pExpr
[
k
].
base
.
pParam
[
0
].
param
.
nType
;
if
(
TSDB_DATA_TYPE_NULL
==
type
)
{
colDataAppendNNULL
(
pColInfoData
,
offset
,
pSrcBlock
->
info
.
rows
);
}
else
{
char
*
p
=
taosVariantGet
(
&
pExpr
[
k
].
base
.
pParam
[
0
].
param
,
type
);
for
(
int32_t
i
=
0
;
i
<
pSrcBlock
->
info
.
rows
;
++
i
)
{
colDataAppend
(
pColInfoData
,
i
+
offset
,
p
,
false
);
}
}
numOfRows
=
pSrcBlock
->
info
.
rows
;
}
else
if
(
pExpr
[
k
].
pExpr
->
nodeType
==
QUERY_NODE_OPERATOR
)
{
SArray
*
pBlockList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
taosArrayPush
(
pBlockList
,
&
pSrcBlock
);
SColumnInfoData
*
pResColData
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
SColumnInfoData
idata
=
{.
info
=
pResColData
->
info
,
.
hasNull
=
true
};
SScalarParam
dest
=
{.
columnData
=
&
idata
};
int32_t
code
=
scalarCalculate
(
pExpr
[
k
].
pExpr
->
_optrRoot
.
pRootNode
,
pBlockList
,
&
dest
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
pBlockList
);
return
code
;
}
int32_t
startOffset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
ASSERT
(
pResult
->
info
.
capacity
>
0
);
colDataMergeCol
(
pResColData
,
startOffset
,
(
int32_t
*
)
&
pResult
->
info
.
capacity
,
&
idata
,
dest
.
numOfRows
);
colDataDestroy
(
&
idata
);
numOfRows
=
dest
.
numOfRows
;
taosArrayDestroy
(
pBlockList
);
}
else
if
(
pExpr
[
k
].
pExpr
->
nodeType
==
QUERY_NODE_FUNCTION
)
{
// _rowts/_c0, not tbname column
if
(
fmIsPseudoColumnFunc
(
pfCtx
->
functionId
)
&&
(
!
fmIsScanPseudoColumnFunc
(
pfCtx
->
functionId
)))
{
// do nothing
}
else
if
(
fmIsIndefiniteRowsFunc
(
pfCtx
->
functionId
))
{
SResultRowEntryInfo
*
pResInfo
=
GET_RES_INFO
(
pfCtx
);
pfCtx
->
fpSet
.
init
(
pfCtx
,
pResInfo
);
pfCtx
->
pOutput
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
pfCtx
->
offset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
// set the start offset
// set the timestamp(_rowts) output buffer
if
(
taosArrayGetSize
(
pPseudoList
)
>
0
)
{
int32_t
*
outputColIndex
=
taosArrayGet
(
pPseudoList
,
0
);
pfCtx
->
pTsOutput
=
(
SColumnInfoData
*
)
pCtx
[
*
outputColIndex
].
pOutput
;
}
// link pDstBlock to set selectivity value
if
(
pfCtx
->
subsidiaries
.
num
>
0
)
{
pfCtx
->
pDstBlock
=
pResult
;
}
int32_t
code
=
pfCtx
->
fpSet
.
process
(
pfCtx
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
numOfRows
=
pResInfo
->
numOfRes
;
}
else
if
(
fmIsAggFunc
(
pfCtx
->
functionId
))
{
// selective value output should be set during corresponding function execution
if
(
fmIsSelectValueFunc
(
pfCtx
->
functionId
))
{
continue
;
}
// _group_key function for "partition by tbname" + csum(col_name) query
SColumnInfoData
*
pOutput
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
int32_t
slotId
=
pfCtx
->
param
[
0
].
pCol
->
slotId
;
// todo handle the json tag
SColumnInfoData
*
pInput
=
taosArrayGet
(
pSrcBlock
->
pDataBlock
,
slotId
);
for
(
int32_t
f
=
0
;
f
<
pSrcBlock
->
info
.
rows
;
++
f
)
{
bool
isNull
=
colDataIsNull_s
(
pInput
,
f
);
if
(
isNull
)
{
colDataAppendNULL
(
pOutput
,
pResult
->
info
.
rows
+
f
);
}
else
{
char
*
data
=
colDataGetData
(
pInput
,
f
);
colDataAppend
(
pOutput
,
pResult
->
info
.
rows
+
f
,
data
,
isNull
);
}
}
}
else
{
SArray
*
pBlockList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
taosArrayPush
(
pBlockList
,
&
pSrcBlock
);
SColumnInfoData
*
pResColData
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
SColumnInfoData
idata
=
{.
info
=
pResColData
->
info
,
.
hasNull
=
true
};
SScalarParam
dest
=
{.
columnData
=
&
idata
};
int32_t
code
=
scalarCalculate
((
SNode
*
)
pExpr
[
k
].
pExpr
->
_function
.
pFunctNode
,
pBlockList
,
&
dest
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
pBlockList
);
return
code
;
}
int32_t
startOffset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
ASSERT
(
pResult
->
info
.
capacity
>
0
);
colDataMergeCol
(
pResColData
,
startOffset
,
(
int32_t
*
)
&
pResult
->
info
.
capacity
,
&
idata
,
dest
.
numOfRows
);
colDataDestroy
(
&
idata
);
numOfRows
=
dest
.
numOfRows
;
taosArrayDestroy
(
pBlockList
);
}
}
else
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
}
if
(
!
createNewColModel
)
{
pResult
->
info
.
rows
+=
numOfRows
;
}
return
TSDB_CODE_SUCCESS
;
}
source/libs/executor/src/scanoperator.c
浏览文件 @
682b3b60
...
@@ -184,7 +184,7 @@ static int32_t doDynamicPruneDataBlock(SOperatorInfo* pOperator, SDataBlockInfo*
...
@@ -184,7 +184,7 @@ static int32_t doDynamicPruneDataBlock(SOperatorInfo* pOperator, SDataBlockInfo*
SExprSupp
*
pSup1
=
pTableScanInfo
->
base
.
pdInfo
.
pExprSup
;
SExprSupp
*
pSup1
=
pTableScanInfo
->
base
.
pdInfo
.
pExprSup
;
SFilePage
*
pPage
=
NULL
;
SFilePage
*
pPage
=
NULL
;
SResultRow
*
pRow
=
getTableGroupOutputBuf
(
pOperator
,
pBlockInfo
->
groupId
,
&
pPage
);
SResultRow
*
pRow
=
getTableGroupOutputBuf
(
pOperator
,
pBlockInfo
->
id
.
groupId
,
&
pPage
);
if
(
pRow
==
NULL
)
{
if
(
pRow
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -484,13 +484,13 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
...
@@ -484,13 +484,13 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
// 1. check if it is existed in meta cache
// 1. check if it is existed in meta cache
if
(
pCache
==
NULL
)
{
if
(
pCache
==
NULL
)
{
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
code
=
metaGetTableEntryByUidCache
(
&
mr
,
pBlock
->
info
.
uid
);
code
=
metaGetTableEntryByUidCache
(
&
mr
,
pBlock
->
info
.
id
.
uid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
terrno
==
TSDB_CODE_PAR_TABLE_NOT_EXIST
)
{
if
(
terrno
==
TSDB_CODE_PAR_TABLE_NOT_EXIST
)
{
qWarn
(
"failed to get table meta, table may have been dropped, uid:0x%"
PRIx64
", code:%s, %s"
,
pBlock
->
info
.
uid
,
qWarn
(
"failed to get table meta, table may have been dropped, uid:0x%"
PRIx64
", code:%s, %s"
,
pBlock
->
info
.
id
.
uid
,
tstrerror
(
terrno
),
idStr
);
tstrerror
(
terrno
),
idStr
);
}
else
{
}
else
{
qError
(
"failed to get table meta, uid:0x%"
PRIx64
", code:%s, %s"
,
pBlock
->
info
.
uid
,
tstrerror
(
terrno
),
idStr
);
qError
(
"failed to get table meta, uid:0x%"
PRIx64
", code:%s, %s"
,
pBlock
->
info
.
id
.
uid
,
tstrerror
(
terrno
),
idStr
);
}
}
metaReaderClear
(
&
mr
);
metaReaderClear
(
&
mr
);
return
terrno
;
return
terrno
;
...
@@ -505,16 +505,16 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
...
@@ -505,16 +505,16 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
}
else
{
}
else
{
pCache
->
metaFetch
+=
1
;
pCache
->
metaFetch
+=
1
;
h
=
taosLRUCacheLookup
(
pCache
->
pTableMetaEntryCache
,
&
pBlock
->
info
.
uid
,
sizeof
(
pBlock
->
info
.
uid
));
h
=
taosLRUCacheLookup
(
pCache
->
pTableMetaEntryCache
,
&
pBlock
->
info
.
id
.
uid
,
sizeof
(
pBlock
->
info
.
id
.
uid
));
if
(
h
==
NULL
)
{
if
(
h
==
NULL
)
{
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
code
=
metaGetTableEntryByUidCache
(
&
mr
,
pBlock
->
info
.
uid
);
code
=
metaGetTableEntryByUidCache
(
&
mr
,
pBlock
->
info
.
id
.
uid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
terrno
==
TSDB_CODE_PAR_TABLE_NOT_EXIST
)
{
if
(
terrno
==
TSDB_CODE_PAR_TABLE_NOT_EXIST
)
{
qWarn
(
"failed to get table meta, table may have been dropped, uid:0x%"
PRIx64
", code:%s, %s"
,
qWarn
(
"failed to get table meta, table may have been dropped, uid:0x%"
PRIx64
", code:%s, %s"
,
pBlock
->
info
.
uid
,
tstrerror
(
terrno
),
idStr
);
pBlock
->
info
.
id
.
uid
,
tstrerror
(
terrno
),
idStr
);
}
else
{
}
else
{
qError
(
"failed to get table meta, uid:0x%"
PRIx64
", code:%s, %s"
,
pBlock
->
info
.
uid
,
tstrerror
(
terrno
),
qError
(
"failed to get table meta, uid:0x%"
PRIx64
", code:%s, %s"
,
pBlock
->
info
.
id
.
uid
,
tstrerror
(
terrno
),
idStr
);
idStr
);
}
}
metaReaderClear
(
&
mr
);
metaReaderClear
(
&
mr
);
...
@@ -528,7 +528,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
...
@@ -528,7 +528,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
val
=
*
pVal
;
val
=
*
pVal
;
freeReader
=
true
;
freeReader
=
true
;
int32_t
ret
=
taosLRUCacheInsert
(
pCache
->
pTableMetaEntryCache
,
&
pBlock
->
info
.
uid
,
sizeof
(
uint64_t
),
pVal
,
int32_t
ret
=
taosLRUCacheInsert
(
pCache
->
pTableMetaEntryCache
,
&
pBlock
->
info
.
id
.
uid
,
sizeof
(
uint64_t
),
pVal
,
sizeof
(
STableCachedVal
),
freeCachedMetaItem
,
NULL
,
TAOS_LRU_PRIORITY_LOW
);
sizeof
(
STableCachedVal
),
freeCachedMetaItem
,
NULL
,
TAOS_LRU_PRIORITY_LOW
);
if
(
ret
!=
TAOS_LRU_STATUS_OK
)
{
if
(
ret
!=
TAOS_LRU_STATUS_OK
)
{
qError
(
"failed to put meta into lru cache, code:%d, %s"
,
ret
,
idStr
);
qError
(
"failed to put meta into lru cache, code:%d, %s"
,
ret
,
idStr
);
...
@@ -642,13 +642,13 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
...
@@ -642,13 +642,13 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
SDataBlockInfo
*
pBInfo
=
&
pBlock
->
info
;
SDataBlockInfo
*
pBInfo
=
&
pBlock
->
info
;
int32_t
rows
=
0
;
int32_t
rows
=
0
;
tsdbRetrieveDataBlockInfo
(
pTableScanInfo
->
base
.
dataReader
,
&
rows
,
&
pBInfo
->
uid
,
&
pBInfo
->
window
);
tsdbRetrieveDataBlockInfo
(
pTableScanInfo
->
base
.
dataReader
,
&
rows
,
&
pBInfo
->
id
.
uid
,
&
pBInfo
->
window
);
blockDataEnsureCapacity
(
pBlock
,
rows
);
// todo remove it latter
blockDataEnsureCapacity
(
pBlock
,
rows
);
// todo remove it latter
pBInfo
->
rows
=
rows
;
pBInfo
->
rows
=
rows
;
ASSERT
(
pBInfo
->
uid
!=
0
);
ASSERT
(
pBInfo
->
id
.
uid
!=
0
);
pBlock
->
info
.
groupId
=
getTableGroupId
(
pTaskInfo
->
pTableInfoList
,
pBlock
->
info
.
uid
);
pBlock
->
info
.
id
.
groupId
=
getTableGroupId
(
pTaskInfo
->
pTableInfoList
,
pBlock
->
info
.
id
.
uid
);
uint32_t
status
=
0
;
uint32_t
status
=
0
;
int32_t
code
=
loadDataBlock
(
pOperator
,
&
pTableScanInfo
->
base
,
pBlock
,
&
status
);
int32_t
code
=
loadDataBlock
(
pOperator
,
&
pTableScanInfo
->
base
,
pBlock
,
&
status
);
...
@@ -668,13 +668,13 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
...
@@ -668,13 +668,13 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
pOperator
->
cost
.
totalCost
=
pTableScanInfo
->
base
.
readRecorder
.
elapsedTime
;
pOperator
->
cost
.
totalCost
=
pTableScanInfo
->
base
.
readRecorder
.
elapsedTime
;
// todo refactor
// todo refactor
/*pTableScanInfo->lastStatus.uid = pBlock->info.uid;*/
/*pTableScanInfo->lastStatus.uid = pBlock->info.
id.
uid;*/
/*pTableScanInfo->lastStatus.ts = pBlock->info.window.ekey;*/
/*pTableScanInfo->lastStatus.ts = pBlock->info.window.ekey;*/
pTaskInfo
->
streamInfo
.
lastStatus
.
type
=
TMQ_OFFSET__SNAPSHOT_DATA
;
pTaskInfo
->
streamInfo
.
lastStatus
.
type
=
TMQ_OFFSET__SNAPSHOT_DATA
;
pTaskInfo
->
streamInfo
.
lastStatus
.
uid
=
pBlock
->
info
.
uid
;
pTaskInfo
->
streamInfo
.
lastStatus
.
uid
=
pBlock
->
info
.
id
.
uid
;
pTaskInfo
->
streamInfo
.
lastStatus
.
ts
=
pBlock
->
info
.
window
.
ekey
;
pTaskInfo
->
streamInfo
.
lastStatus
.
ts
=
pBlock
->
info
.
window
.
ekey
;
ASSERT
(
pBlock
->
info
.
uid
!=
0
);
ASSERT
(
pBlock
->
info
.
id
.
uid
!=
0
);
return
pBlock
;
return
pBlock
;
}
}
return
NULL
;
return
NULL
;
...
@@ -786,7 +786,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
...
@@ -786,7 +786,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
SSDataBlock
*
result
=
doGroupedTableScan
(
pOperator
);
SSDataBlock
*
result
=
doGroupedTableScan
(
pOperator
);
if
(
result
!=
NULL
)
{
if
(
result
!=
NULL
)
{
ASSERT
(
result
->
info
.
uid
!=
0
);
ASSERT
(
result
->
info
.
id
.
uid
!=
0
);
return
result
;
return
result
;
}
}
...
@@ -885,7 +885,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
...
@@ -885,7 +885,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
pInfo
->
base
.
dataBlockLoadFlag
=
pTableScanNode
->
dataRequired
;
pInfo
->
base
.
dataBlockLoadFlag
=
pTableScanNode
->
dataRequired
;
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
pInfo
->
pResBlock
=
create
ResDataBlock
(
pDescNode
);
pInfo
->
pResBlock
=
create
DataBlockFromDescNode
(
pDescNode
);
blockDataEnsureCapacity
(
pInfo
->
pResBlock
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
pResBlock
,
pOperator
->
resultInfo
.
capacity
);
code
=
filterInitFromNode
((
SNode
*
)
pTableScanNode
->
scan
.
node
.
pConditions
,
&
pOperator
->
exprSupp
.
pFilterInfo
,
0
);
code
=
filterInitFromNode
((
SNode
*
)
pTableScanNode
->
scan
.
node
.
pConditions
,
&
pOperator
->
exprSupp
.
pFilterInfo
,
0
);
...
@@ -1009,7 +1009,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
...
@@ -1009,7 +1009,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
SDataBlockInfo
*
pBInfo
=
&
pBlock
->
info
;
SDataBlockInfo
*
pBInfo
=
&
pBlock
->
info
;
int32_t
rows
=
0
;
int32_t
rows
=
0
;
tsdbRetrieveDataBlockInfo
(
pReader
,
&
rows
,
&
pBInfo
->
uid
,
&
pBInfo
->
window
);
tsdbRetrieveDataBlockInfo
(
pReader
,
&
rows
,
&
pBInfo
->
id
.
uid
,
&
pBInfo
->
window
);
SArray
*
pCols
=
tsdbRetrieveDataBlock
(
pReader
,
NULL
);
SArray
*
pCols
=
tsdbRetrieveDataBlock
(
pReader
,
NULL
);
blockDataEnsureCapacity
(
pBlock
,
rows
);
blockDataEnsureCapacity
(
pBlock
,
rows
);
...
@@ -1018,7 +1018,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
...
@@ -1018,7 +1018,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
relocateColumnData
(
pBlock
,
pTableScanInfo
->
base
.
matchInfo
.
pList
,
pCols
,
true
);
relocateColumnData
(
pBlock
,
pTableScanInfo
->
base
.
matchInfo
.
pList
,
pCols
,
true
);
doSetTagColumnData
(
&
pTableScanInfo
->
base
,
pBlock
,
pTaskInfo
,
rows
);
doSetTagColumnData
(
&
pTableScanInfo
->
base
,
pBlock
,
pTaskInfo
,
rows
);
pBlock
->
info
.
groupId
=
getTableGroupId
(
pTaskInfo
->
pTableInfoList
,
pBInfo
->
uid
);
pBlock
->
info
.
id
.
groupId
=
getTableGroupId
(
pTaskInfo
->
pTableInfoList
,
pBInfo
->
id
.
uid
);
}
}
tsdbReaderClose
(
pReader
);
tsdbReaderClose
(
pReader
);
...
@@ -1175,7 +1175,7 @@ static SSDataBlock* doRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32
...
@@ -1175,7 +1175,7 @@ static SSDataBlock* doRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32
pResult
->
info
.
calWin
=
pInfo
->
updateWin
;
pResult
->
info
.
calWin
=
pInfo
->
updateWin
;
return
pResult
;
return
pResult
;
}
}
}
else
if
(
pResult
->
info
.
groupId
==
pInfo
->
groupId
)
{
}
else
if
(
pResult
->
info
.
id
.
groupId
==
pInfo
->
groupId
)
{
pResult
->
info
.
calWin
=
pInfo
->
updateWin
;
pResult
->
info
.
calWin
=
pInfo
->
updateWin
;
return
pResult
;
return
pResult
;
}
}
...
@@ -1366,7 +1366,7 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
...
@@ -1366,7 +1366,7 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
if
(
pBlock
==
NULL
||
pBlock
->
info
.
rows
==
0
)
return
;
if
(
pBlock
==
NULL
||
pBlock
->
info
.
rows
==
0
)
return
;
void
*
tbname
=
NULL
;
void
*
tbname
=
NULL
;
if
(
streamStateGetParName
(
pInfo
->
pStreamScanOp
->
pTaskInfo
->
streamInfo
.
pState
,
pBlock
->
info
.
groupId
,
&
tbname
)
<
0
)
{
if
(
streamStateGetParName
(
pInfo
->
pStreamScanOp
->
pTaskInfo
->
streamInfo
.
pState
,
pBlock
->
info
.
id
.
groupId
,
&
tbname
)
<
0
)
{
pBlock
->
info
.
parTbName
[
0
]
=
0
;
pBlock
->
info
.
parTbName
[
0
]
=
0
;
}
else
{
}
else
{
memcpy
(
pBlock
->
info
.
parTbName
,
tbname
,
TSDB_TABLE_NAME_LEN
);
memcpy
(
pBlock
->
info
.
parTbName
,
tbname
,
TSDB_TABLE_NAME_LEN
);
...
@@ -1399,8 +1399,8 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
...
@@ -1399,8 +1399,8 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
pBlock
->
info
.
parTbName
[
0
]
=
0
;
pBlock
->
info
.
parTbName
[
0
]
=
0
;
}
}
if
(
pBlock
->
info
.
groupId
&&
pBlock
->
info
.
parTbName
[
0
])
{
if
(
pBlock
->
info
.
id
.
groupId
&&
pBlock
->
info
.
parTbName
[
0
])
{
streamStatePutParName
(
pState
,
pBlock
->
info
.
groupId
,
pBlock
->
info
.
parTbName
);
streamStatePutParName
(
pState
,
pBlock
->
info
.
id
.
groupId
,
pBlock
->
info
.
parTbName
);
}
}
blockDataDestroy
(
pSrcBlock
);
blockDataDestroy
(
pSrcBlock
);
...
@@ -1434,7 +1434,7 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
...
@@ -1434,7 +1434,7 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
SColumnInfoData
*
pColDataInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
pInfo
->
primaryTsIndex
);
SColumnInfoData
*
pColDataInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
pInfo
->
primaryTsIndex
);
ASSERT
(
pColDataInfo
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
ASSERT
(
pColDataInfo
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
TSKEY
*
tsCol
=
(
TSKEY
*
)
pColDataInfo
->
pData
;
TSKEY
*
tsCol
=
(
TSKEY
*
)
pColDataInfo
->
pData
;
bool
tableInserted
=
updateInfoIsTableInserted
(
pInfo
->
pUpdateInfo
,
pBlock
->
info
.
uid
);
bool
tableInserted
=
updateInfoIsTableInserted
(
pInfo
->
pUpdateInfo
,
pBlock
->
info
.
id
.
uid
);
for
(
int32_t
rowId
=
0
;
rowId
<
pBlock
->
info
.
rows
;
rowId
++
)
{
for
(
int32_t
rowId
=
0
;
rowId
<
pBlock
->
info
.
rows
;
rowId
++
)
{
SResultRowInfo
dumyInfo
;
SResultRowInfo
dumyInfo
;
dumyInfo
.
cur
.
pageId
=
-
1
;
dumyInfo
.
cur
.
pageId
=
-
1
;
...
@@ -1445,18 +1445,18 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
...
@@ -1445,18 +1445,18 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
isClosed
=
isCloseWindow
(
&
win
,
&
pInfo
->
twAggSup
);
isClosed
=
isCloseWindow
(
&
win
,
&
pInfo
->
twAggSup
);
}
}
// must check update info first.
// must check update info first.
bool
update
=
updateInfoIsUpdated
(
pInfo
->
pUpdateInfo
,
pBlock
->
info
.
uid
,
tsCol
[
rowId
]);
bool
update
=
updateInfoIsUpdated
(
pInfo
->
pUpdateInfo
,
pBlock
->
info
.
id
.
uid
,
tsCol
[
rowId
]);
bool
closedWin
=
isClosed
&&
isSignleIntervalWindow
(
pInfo
)
&&
bool
closedWin
=
isClosed
&&
isSignleIntervalWindow
(
pInfo
)
&&
isDeletedStreamWindow
(
&
win
,
pBlock
->
info
.
groupId
,
isDeletedStreamWindow
(
&
win
,
pBlock
->
info
.
id
.
groupId
,
pInfo
->
pTableScanOp
->
pTaskInfo
->
streamInfo
.
pState
,
&
pInfo
->
twAggSup
);
pInfo
->
pTableScanOp
->
pTaskInfo
->
streamInfo
.
pState
,
&
pInfo
->
twAggSup
);
if
((
update
||
closedWin
)
&&
out
)
{
if
((
update
||
closedWin
)
&&
out
)
{
qDebug
(
"stream update check not pass, update %d, closedWin %d"
,
update
,
closedWin
);
qDebug
(
"stream update check not pass, update %d, closedWin %d"
,
update
,
closedWin
);
uint64_t
gpId
=
0
;
uint64_t
gpId
=
0
;
appendOneRowToStreamSpecialBlock
(
pInfo
->
pUpdateDataRes
,
tsCol
+
rowId
,
tsCol
+
rowId
,
&
pBlock
->
info
.
uid
,
&
gpId
,
appendOneRowToStreamSpecialBlock
(
pInfo
->
pUpdateDataRes
,
tsCol
+
rowId
,
tsCol
+
rowId
,
&
pBlock
->
info
.
id
.
uid
,
&
gpId
,
NULL
);
NULL
);
if
(
closedWin
&&
pInfo
->
partitionSup
.
needCalc
)
{
if
(
closedWin
&&
pInfo
->
partitionSup
.
needCalc
)
{
gpId
=
calGroupIdByData
(
&
pInfo
->
partitionSup
,
pInfo
->
pPartScalarSup
,
pBlock
,
rowId
);
gpId
=
calGroupIdByData
(
&
pInfo
->
partitionSup
,
pInfo
->
pPartScalarSup
,
pBlock
,
rowId
);
appendOneRowToStreamSpecialBlock
(
pInfo
->
pUpdateDataRes
,
tsCol
+
rowId
,
tsCol
+
rowId
,
&
pBlock
->
info
.
uid
,
&
gpId
,
appendOneRowToStreamSpecialBlock
(
pInfo
->
pUpdateDataRes
,
tsCol
+
rowId
,
tsCol
+
rowId
,
&
pBlock
->
info
.
id
.
uid
,
&
gpId
,
NULL
);
NULL
);
}
}
}
}
...
@@ -1476,11 +1476,11 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
...
@@ -1476,11 +1476,11 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pBlock
->
info
.
rows
);
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pBlock
->
info
.
rows
);
pInfo
->
pRes
->
info
.
rows
=
pBlock
->
info
.
rows
;
pInfo
->
pRes
->
info
.
rows
=
pBlock
->
info
.
rows
;
pInfo
->
pRes
->
info
.
uid
=
pBlock
->
info
.
uid
;
pInfo
->
pRes
->
info
.
id
.
uid
=
pBlock
->
info
.
id
.
uid
;
pInfo
->
pRes
->
info
.
type
=
STREAM_NORMAL
;
pInfo
->
pRes
->
info
.
type
=
STREAM_NORMAL
;
pInfo
->
pRes
->
info
.
version
=
pBlock
->
info
.
version
;
pInfo
->
pRes
->
info
.
version
=
pBlock
->
info
.
version
;
pInfo
->
pRes
->
info
.
groupId
=
getTableGroupId
(
pTaskInfo
->
pTableInfoList
,
pBlock
->
info
.
uid
);
pInfo
->
pRes
->
info
.
id
.
groupId
=
getTableGroupId
(
pTaskInfo
->
pTableInfoList
,
pBlock
->
info
.
id
.
uid
);
// todo extract method
// todo extract method
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
matchInfo
.
pList
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
matchInfo
.
pList
);
++
i
)
{
...
@@ -1807,8 +1807,8 @@ FETCH_NEXT_BLOCK:
...
@@ -1807,8 +1807,8 @@ FETCH_NEXT_BLOCK:
int32_t
current
=
pInfo
->
validBlockIndex
++
;
int32_t
current
=
pInfo
->
validBlockIndex
++
;
SSDataBlock
*
pBlock
=
taosArrayGetP
(
pInfo
->
pBlockLists
,
current
);
SSDataBlock
*
pBlock
=
taosArrayGetP
(
pInfo
->
pBlockLists
,
current
);
if
(
pBlock
->
info
.
groupId
&&
pBlock
->
info
.
parTbName
[
0
])
{
if
(
pBlock
->
info
.
id
.
groupId
&&
pBlock
->
info
.
parTbName
[
0
])
{
streamStatePutParName
(
pTaskInfo
->
streamInfo
.
pState
,
pBlock
->
info
.
groupId
,
pBlock
->
info
.
parTbName
);
streamStatePutParName
(
pTaskInfo
->
streamInfo
.
pState
,
pBlock
->
info
.
id
.
groupId
,
pBlock
->
info
.
parTbName
);
}
}
// TODO move into scan
// TODO move into scan
pBlock
->
info
.
calWin
.
skey
=
INT64_MIN
;
pBlock
->
info
.
calWin
.
skey
=
INT64_MIN
;
...
@@ -1960,7 +1960,7 @@ FETCH_NEXT_BLOCK:
...
@@ -1960,7 +1960,7 @@ FETCH_NEXT_BLOCK:
setBlockIntoRes
(
pInfo
,
&
block
,
false
);
setBlockIntoRes
(
pInfo
,
&
block
,
false
);
if
(
updateInfoIgnore
(
pInfo
->
pUpdateInfo
,
&
pInfo
->
pRes
->
info
.
window
,
pInfo
->
pRes
->
info
.
groupId
,
if
(
updateInfoIgnore
(
pInfo
->
pUpdateInfo
,
&
pInfo
->
pRes
->
info
.
window
,
pInfo
->
pRes
->
info
.
id
.
groupId
,
pInfo
->
pRes
->
info
.
version
))
{
pInfo
->
pRes
->
info
.
version
))
{
printDataBlock
(
pInfo
->
pRes
,
"stream scan ignore"
);
printDataBlock
(
pInfo
->
pRes
,
"stream scan ignore"
);
blockDataCleanup
(
pInfo
->
pRes
);
blockDataCleanup
(
pInfo
->
pRes
);
...
@@ -2050,7 +2050,7 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
...
@@ -2050,7 +2050,7 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
}
}
int32_t
rows
=
0
;
int32_t
rows
=
0
;
tsdbRetrieveDataBlockInfo
(
pInfo
->
dataReader
,
&
rows
,
&
pBlock
->
info
.
uid
,
&
pBlock
->
info
.
window
);
tsdbRetrieveDataBlockInfo
(
pInfo
->
dataReader
,
&
rows
,
&
pBlock
->
info
.
id
.
uid
,
&
pBlock
->
info
.
window
);
pBlock
->
info
.
rows
=
rows
;
pBlock
->
info
.
rows
=
rows
;
SArray
*
pCols
=
tsdbRetrieveDataBlock
(
pInfo
->
dataReader
,
NULL
);
SArray
*
pCols
=
tsdbRetrieveDataBlock
(
pInfo
->
dataReader
,
NULL
);
...
@@ -2059,9 +2059,9 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
...
@@ -2059,9 +2059,9 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
longjmp
(
pTaskInfo
->
env
,
terrno
);
longjmp
(
pTaskInfo
->
env
,
terrno
);
}
}
qDebug
(
"tmqsnap doRawScan get data uid:%"
PRId64
""
,
pBlock
->
info
.
uid
);
qDebug
(
"tmqsnap doRawScan get data uid:%"
PRId64
""
,
pBlock
->
info
.
id
.
uid
);
pTaskInfo
->
streamInfo
.
lastStatus
.
type
=
TMQ_OFFSET__SNAPSHOT_DATA
;
pTaskInfo
->
streamInfo
.
lastStatus
.
type
=
TMQ_OFFSET__SNAPSHOT_DATA
;
pTaskInfo
->
streamInfo
.
lastStatus
.
uid
=
pBlock
->
info
.
uid
;
pTaskInfo
->
streamInfo
.
lastStatus
.
uid
=
pBlock
->
info
.
id
.
uid
;
pTaskInfo
->
streamInfo
.
lastStatus
.
ts
=
pBlock
->
info
.
window
.
ekey
;
pTaskInfo
->
streamInfo
.
lastStatus
.
ts
=
pBlock
->
info
.
window
.
ekey
;
return
pBlock
;
return
pBlock
;
}
}
...
@@ -2352,7 +2352,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
...
@@ -2352,7 +2352,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
goto
_error
;
goto
_error
;
}
}
pInfo
->
pRes
=
create
ResDataBlock
(
pDescNode
);
pInfo
->
pRes
=
create
DataBlockFromDescNode
(
pDescNode
);
pInfo
->
pUpdateRes
=
createSpecialDataBlock
(
STREAM_CLEAR
);
pInfo
->
pUpdateRes
=
createSpecialDataBlock
(
STREAM_CLEAR
);
pInfo
->
scanMode
=
STREAM_SCAN_FROM_READERHANDLE
;
pInfo
->
scanMode
=
STREAM_SCAN_FROM_READERHANDLE
;
pInfo
->
windowSup
=
(
SWindowSupporter
){.
pStreamAggSup
=
NULL
,
.
gap
=
-
1
,
.
parentType
=
QUERY_NODE_PHYSICAL_PLAN
};
pInfo
->
windowSup
=
(
SWindowSupporter
){.
pStreamAggSup
=
NULL
,
.
gap
=
-
1
,
.
parentType
=
QUERY_NODE_PHYSICAL_PLAN
};
...
@@ -2476,8 +2476,7 @@ static void destroyTagScanOperatorInfo(void* param) {
...
@@ -2476,8 +2476,7 @@ static void destroyTagScanOperatorInfo(void* param) {
taosMemoryFreeClear
(
param
);
taosMemoryFreeClear
(
param
);
}
}
SOperatorInfo
*
createTagScanOperatorInfo
(
SReadHandle
*
pReadHandle
,
STagScanPhysiNode
*
pPhyNode
,
SOperatorInfo
*
createTagScanOperatorInfo
(
SReadHandle
*
pReadHandle
,
STagScanPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
)
{
STableListInfo
*
pTableListInfo
,
SExecTaskInfo
*
pTaskInfo
)
{
STagScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STagScanInfo
));
STagScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STagScanInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
...
@@ -2499,7 +2498,7 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi
...
@@ -2499,7 +2498,7 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi
goto
_error
;
goto
_error
;
}
}
pInfo
->
pRes
=
create
ResDataBlock
(
pDescNode
);
pInfo
->
pRes
=
create
DataBlockFromDescNode
(
pDescNode
);
pInfo
->
readHandle
=
*
pReadHandle
;
pInfo
->
readHandle
=
*
pReadHandle
;
pInfo
->
curPos
=
0
;
pInfo
->
curPos
=
0
;
...
@@ -2556,7 +2555,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
...
@@ -2556,7 +2555,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
blockDataCleanup
(
pBlock
);
blockDataCleanup
(
pBlock
);
int32_t
rows
=
0
;
int32_t
rows
=
0
;
tsdbRetrieveDataBlockInfo
(
reader
,
&
rows
,
&
pBlock
->
info
.
uid
,
&
pBlock
->
info
.
window
);
tsdbRetrieveDataBlockInfo
(
reader
,
&
rows
,
&
pBlock
->
info
.
id
.
uid
,
&
pBlock
->
info
.
window
);
blockDataEnsureCapacity
(
pBlock
,
rows
);
blockDataEnsureCapacity
(
pBlock
,
rows
);
pBlock
->
info
.
rows
=
rows
;
pBlock
->
info
.
rows
=
rows
;
...
@@ -2578,7 +2577,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
...
@@ -2578,7 +2577,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
continue
;
continue
;
}
}
pBlock
->
info
.
groupId
=
getTableGroupId
(
pTaskInfo
->
pTableInfoList
,
pBlock
->
info
.
uid
);
pBlock
->
info
.
id
.
groupId
=
getTableGroupId
(
pTaskInfo
->
pTableInfoList
,
pBlock
->
info
.
id
.
uid
);
pOperator
->
resultInfo
.
totalRows
+=
pBlock
->
info
.
rows
;
pOperator
->
resultInfo
.
totalRows
+=
pBlock
->
info
.
rows
;
pTableScanInfo
->
base
.
readRecorder
.
elapsedTime
+=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
pTableScanInfo
->
base
.
readRecorder
.
elapsedTime
+=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
...
@@ -2613,7 +2612,7 @@ SArray* generateSortByTsInfo(SArray* colMatchInfo, int32_t order) {
...
@@ -2613,7 +2612,7 @@ SArray* generateSortByTsInfo(SArray* colMatchInfo, int32_t order) {
return
pList
;
return
pList
;
}
}
int32_t
dump
S
QueryTableCond
(
const
SQueryTableDataCond
*
src
,
SQueryTableDataCond
*
dst
)
{
int32_t
dumpQueryTableCond
(
const
SQueryTableDataCond
*
src
,
SQueryTableDataCond
*
dst
)
{
memcpy
((
void
*
)
dst
,
(
void
*
)
src
,
sizeof
(
SQueryTableDataCond
));
memcpy
((
void
*
)
dst
,
(
void
*
)
src
,
sizeof
(
SQueryTableDataCond
));
dst
->
colList
=
taosMemoryCalloc
(
src
->
numOfCols
,
sizeof
(
SColumnInfo
));
dst
->
colList
=
taosMemoryCalloc
(
src
->
numOfCols
,
sizeof
(
SColumnInfo
));
for
(
int
i
=
0
;
i
<
src
->
numOfCols
;
i
++
)
{
for
(
int
i
=
0
;
i
<
src
->
numOfCols
;
i
++
)
{
...
@@ -2664,7 +2663,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
...
@@ -2664,7 +2663,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
taosArrayPush
(
pInfo
->
sortSourceParams
,
&
param
);
taosArrayPush
(
pInfo
->
sortSourceParams
,
&
param
);
SQueryTableDataCond
cond
;
SQueryTableDataCond
cond
;
dump
S
QueryTableCond
(
&
pInfo
->
base
.
cond
,
&
cond
);
dumpQueryTableCond
(
&
pInfo
->
base
.
cond
,
&
cond
);
taosArrayPush
(
pInfo
->
queryConds
,
&
cond
);
taosArrayPush
(
pInfo
->
queryConds
,
&
cond
);
}
}
...
@@ -2774,7 +2773,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
...
@@ -2774,7 +2773,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
pBlock
=
getSortedTableMergeScanBlockData
(
pInfo
->
pSortHandle
,
pInfo
->
pResBlock
,
pOperator
->
resultInfo
.
capacity
,
pBlock
=
getSortedTableMergeScanBlockData
(
pInfo
->
pSortHandle
,
pInfo
->
pResBlock
,
pOperator
->
resultInfo
.
capacity
,
pOperator
);
pOperator
);
if
(
pBlock
!=
NULL
)
{
if
(
pBlock
!=
NULL
)
{
pBlock
->
info
.
groupId
=
pInfo
->
groupId
;
pBlock
->
info
.
id
.
groupId
=
pInfo
->
groupId
;
pOperator
->
resultInfo
.
totalRows
+=
pBlock
->
info
.
rows
;
pOperator
->
resultInfo
.
totalRows
+=
pBlock
->
info
.
rows
;
return
pBlock
;
return
pBlock
;
}
else
{
}
else
{
...
@@ -2900,7 +2899,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
...
@@ -2900,7 +2899,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
}
}
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
1024
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
1024
);
pInfo
->
pResBlock
=
create
ResDataBlock
(
pDescNode
);
pInfo
->
pResBlock
=
create
DataBlockFromDescNode
(
pDescNode
);
blockDataEnsureCapacity
(
pInfo
->
pResBlock
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
pResBlock
,
pOperator
->
resultInfo
.
capacity
);
pInfo
->
sortSourceParams
=
taosArrayInit
(
64
,
sizeof
(
STableMergeScanSortSourceParam
));
pInfo
->
sortSourceParams
=
taosArrayInit
(
64
,
sizeof
(
STableMergeScanSortSourceParam
));
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
682b3b60
...
@@ -47,7 +47,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode*
...
@@ -47,7 +47,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode*
SDataBlockDescNode
*
pDescNode
=
pSortNode
->
node
.
pOutputDataBlockDesc
;
SDataBlockDescNode
*
pDescNode
=
pSortNode
->
node
.
pOutputDataBlockDesc
;
int32_t
numOfCols
=
0
;
int32_t
numOfCols
=
0
;
SSDataBlock
*
pResBlock
=
create
ResDataBlock
(
pDescNode
);
SSDataBlock
*
pResBlock
=
create
DataBlockFromDescNode
(
pDescNode
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pSortNode
->
pExprs
,
NULL
,
&
numOfCols
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pSortNode
->
pExprs
,
NULL
,
&
numOfCols
);
int32_t
numOfOutputCols
=
0
;
int32_t
numOfOutputCols
=
0
;
...
@@ -359,7 +359,7 @@ SSDataBlock* fetchNextGroupSortDataBlock(void* param) {
...
@@ -359,7 +359,7 @@ SSDataBlock* fetchNextGroupSortDataBlock(void* param) {
SOperatorInfo
*
childOp
=
source
->
childOpInfo
;
SOperatorInfo
*
childOp
=
source
->
childOpInfo
;
SSDataBlock
*
block
=
childOp
->
fpSet
.
getNextFn
(
childOp
);
SSDataBlock
*
block
=
childOp
->
fpSet
.
getNextFn
(
childOp
);
if
(
block
!=
NULL
)
{
if
(
block
!=
NULL
)
{
if
(
block
->
info
.
groupId
==
grpSortOpInfo
->
currGroupId
)
{
if
(
block
->
info
.
id
.
groupId
==
grpSortOpInfo
->
currGroupId
)
{
grpSortOpInfo
->
childOpStatus
=
CHILD_OP_SAME_GROUP
;
grpSortOpInfo
->
childOpStatus
=
CHILD_OP_SAME_GROUP
;
return
block
;
return
block
;
}
else
{
}
else
{
...
@@ -439,7 +439,7 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
...
@@ -439,7 +439,7 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
setOperatorCompleted
(
pOperator
);
setOperatorCompleted
(
pOperator
);
return
NULL
;
return
NULL
;
}
}
pInfo
->
currGroupId
=
pInfo
->
prefetchedSortInput
->
info
.
groupId
;
pInfo
->
currGroupId
=
pInfo
->
prefetchedSortInput
->
info
.
id
.
groupId
;
pInfo
->
childOpStatus
=
CHILD_OP_NEW_GROUP
;
pInfo
->
childOpStatus
=
CHILD_OP_NEW_GROUP
;
beginSortGroup
(
pOperator
);
beginSortGroup
(
pOperator
);
}
}
...
@@ -451,13 +451,13 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
...
@@ -451,13 +451,13 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
pBlock
=
getGroupSortedBlockData
(
pInfo
->
pCurrSortHandle
,
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
pBlock
=
getGroupSortedBlockData
(
pInfo
->
pCurrSortHandle
,
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
pInfo
->
matchInfo
.
pList
,
pInfo
);
pInfo
->
matchInfo
.
pList
,
pInfo
);
if
(
pBlock
!=
NULL
)
{
if
(
pBlock
!=
NULL
)
{
pBlock
->
info
.
groupId
=
pInfo
->
currGroupId
;
pBlock
->
info
.
id
.
groupId
=
pInfo
->
currGroupId
;
pOperator
->
resultInfo
.
totalRows
+=
pBlock
->
info
.
rows
;
pOperator
->
resultInfo
.
totalRows
+=
pBlock
->
info
.
rows
;
return
pBlock
;
return
pBlock
;
}
else
{
}
else
{
if
(
pInfo
->
childOpStatus
==
CHILD_OP_NEW_GROUP
)
{
if
(
pInfo
->
childOpStatus
==
CHILD_OP_NEW_GROUP
)
{
finishSortGroup
(
pOperator
);
finishSortGroup
(
pOperator
);
pInfo
->
currGroupId
=
pInfo
->
prefetchedSortInput
->
info
.
groupId
;
pInfo
->
currGroupId
=
pInfo
->
prefetchedSortInput
->
info
.
id
.
groupId
;
beginSortGroup
(
pOperator
);
beginSortGroup
(
pOperator
);
}
else
if
(
pInfo
->
childOpStatus
==
CHILD_OP_FINISHED
)
{
}
else
if
(
pInfo
->
childOpStatus
==
CHILD_OP_FINISHED
)
{
finishSortGroup
(
pOperator
);
finishSortGroup
(
pOperator
);
...
@@ -509,7 +509,7 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort
...
@@ -509,7 +509,7 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
1024
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
1024
);
pOperator
->
exprSupp
.
pCtx
=
createSqlFunctionCtx
(
pExprInfo
,
numOfCols
,
&
pOperator
->
exprSupp
.
rowEntryInfoOffset
);
pOperator
->
exprSupp
.
pCtx
=
createSqlFunctionCtx
(
pExprInfo
,
numOfCols
,
&
pOperator
->
exprSupp
.
rowEntryInfoOffset
);
pInfo
->
binfo
.
pRes
=
create
ResDataBlock
(
pDescNode
);
pInfo
->
binfo
.
pRes
=
create
DataBlockFromDescNode
(
pDescNode
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
int32_t
numOfOutputCols
=
0
;
int32_t
numOfOutputCols
=
0
;
...
@@ -691,10 +691,10 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
...
@@ -691,10 +691,10 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
pInfo
->
limitInfo
.
numOfOutputRows
+=
p
->
info
.
rows
;
pInfo
->
limitInfo
.
numOfOutputRows
+=
p
->
info
.
rows
;
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
groupId
=
pInfo
->
groupId
;
pDataBlock
->
info
.
id
.
groupId
=
pInfo
->
groupId
;
}
}
qDebug
(
"%s get sorted block, groupId:0x%"
PRIx64
" rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pDataBlock
->
info
.
groupId
,
qDebug
(
"%s get sorted block, groupId:0x%"
PRIx64
" rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pDataBlock
->
info
.
id
.
groupId
,
pDataBlock
->
info
.
rows
);
pDataBlock
->
info
.
rows
);
return
(
pDataBlock
->
info
.
rows
>
0
)
?
pDataBlock
:
NULL
;
return
(
pDataBlock
->
info
.
rows
>
0
)
?
pDataBlock
:
NULL
;
...
@@ -766,7 +766,7 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size
...
@@ -766,7 +766,7 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size
}
}
initLimitInfo
(
pMergePhyNode
->
node
.
pLimit
,
pMergePhyNode
->
node
.
pSlimit
,
&
pInfo
->
limitInfo
);
initLimitInfo
(
pMergePhyNode
->
node
.
pLimit
,
pMergePhyNode
->
node
.
pSlimit
,
&
pInfo
->
limitInfo
);
pInfo
->
binfo
.
pRes
=
create
ResDataBlock
(
pDescNode
);
pInfo
->
binfo
.
pRes
=
create
DataBlockFromDescNode
(
pDescNode
);
int32_t
rowSize
=
pInfo
->
binfo
.
pRes
->
info
.
rowSize
;
int32_t
rowSize
=
pInfo
->
binfo
.
pRes
->
info
.
rowSize
;
ASSERT
(
rowSize
<
100
*
1024
*
1024
);
ASSERT
(
rowSize
<
100
*
1024
*
1024
);
...
@@ -779,7 +779,7 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size
...
@@ -779,7 +779,7 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size
}
}
SPhysiNode
*
pChildNode
=
(
SPhysiNode
*
)
nodesListGetNode
(
pPhyNode
->
pChildren
,
0
);
SPhysiNode
*
pChildNode
=
(
SPhysiNode
*
)
nodesListGetNode
(
pPhyNode
->
pChildren
,
0
);
SSDataBlock
*
pInputBlock
=
create
ResDataBlock
(
pChildNode
->
pOutputDataBlockDesc
);
SSDataBlock
*
pInputBlock
=
create
DataBlockFromDescNode
(
pChildNode
->
pOutputDataBlockDesc
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
...
...
source/libs/executor/src/sysscanoperator.c
浏览文件 @
682b3b60
...
@@ -1411,7 +1411,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
...
@@ -1411,7 +1411,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
pInfo
->
pUser
=
taosMemoryStrDup
((
void
*
)
pUser
);
pInfo
->
pUser
=
taosMemoryStrDup
((
void
*
)
pUser
);
pInfo
->
sysInfo
=
pScanPhyNode
->
sysInfo
;
pInfo
->
sysInfo
=
pScanPhyNode
->
sysInfo
;
pInfo
->
showRewrite
=
pScanPhyNode
->
showRewrite
;
pInfo
->
showRewrite
=
pScanPhyNode
->
showRewrite
;
pInfo
->
pRes
=
create
ResDataBlock
(
pDescNode
);
pInfo
->
pRes
=
create
DataBlockFromDescNode
(
pDescNode
);
pInfo
->
pCondition
=
pScanNode
->
node
.
pConditions
;
pInfo
->
pCondition
=
pScanNode
->
node
.
pConditions
;
code
=
filterInitFromNode
(
pScanNode
->
node
.
pConditions
,
&
pOperator
->
exprSupp
.
pFilterInfo
,
0
);
code
=
filterInitFromNode
(
pScanNode
->
node
.
pConditions
,
&
pOperator
->
exprSupp
.
pFilterInfo
,
0
);
...
@@ -1831,39 +1831,39 @@ static int32_t doGetTableRowSize(void* pMeta, uint64_t uid, int32_t* rowLen, con
...
@@ -1831,39 +1831,39 @@ static int32_t doGetTableRowSize(void* pMeta, uint64_t uid, int32_t* rowLen, con
}
}
static
SSDataBlock
*
doBlockInfoScan
(
SOperatorInfo
*
pOperator
)
{
static
SSDataBlock
*
doBlockInfoScan
(
SOperatorInfo
*
pOperator
)
{
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
return
NULL
;
}
}
SBlockDistInfo
*
pBlockScanInfo
=
pOperator
->
info
;
SBlockDistInfo
*
pBlockScanInfo
=
pOperator
->
info
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
STableBlockDistInfo
blockDistInfo
=
{.
minRows
=
INT_MAX
,
.
maxRows
=
INT_MIN
};
STableBlockDistInfo
blockDistInfo
=
{.
minRows
=
INT_MAX
,
.
maxRows
=
INT_MIN
};
int32_t
code
=
doGetTableRowSize
(
pBlockScanInfo
->
readHandle
.
meta
,
pBlockScanInfo
->
uid
,
int32_t
code
=
doGetTableRowSize
(
pBlockScanInfo
->
readHandle
.
meta
,
pBlockScanInfo
->
uid
,
(
int32_t
*
)
&
blockDistInfo
.
rowSize
,
GET_TASKID
(
pTaskInfo
));
(
int32_t
*
)
&
blockDistInfo
.
rowSize
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
}
}
tsdbGetFileBlocksDistInfo
(
pBlockScanInfo
->
pHandle
,
&
blockDistInfo
);
tsdbGetFileBlocksDistInfo
(
pBlockScanInfo
->
pHandle
,
&
blockDistInfo
);
blockDistInfo
.
numOfInmemRows
=
(
int32_t
)
tsdbGetNumOfRowsInMemTable
(
pBlockScanInfo
->
pHandle
);
blockDistInfo
.
numOfInmemRows
=
(
int32_t
)
tsdbGetNumOfRowsInMemTable
(
pBlockScanInfo
->
pHandle
);
SSDataBlock
*
pBlock
=
pBlockScanInfo
->
pResBlock
;
SSDataBlock
*
pBlock
=
pBlockScanInfo
->
pResBlock
;
int32_t
slotId
=
pOperator
->
exprSupp
.
pExprInfo
->
base
.
resSchema
.
slotId
;
int32_t
slotId
=
pOperator
->
exprSupp
.
pExprInfo
->
base
.
resSchema
.
slotId
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
int32_t
len
=
tSerializeBlockDistInfo
(
NULL
,
0
,
&
blockDistInfo
);
int32_t
len
=
tSerializeBlockDistInfo
(
NULL
,
0
,
&
blockDistInfo
);
char
*
p
=
taosMemoryCalloc
(
1
,
len
+
VARSTR_HEADER_SIZE
);
char
*
p
=
taosMemoryCalloc
(
1
,
len
+
VARSTR_HEADER_SIZE
);
tSerializeBlockDistInfo
(
varDataVal
(
p
),
len
,
&
blockDistInfo
);
tSerializeBlockDistInfo
(
varDataVal
(
p
),
len
,
&
blockDistInfo
);
varDataSetLen
(
p
,
len
);
varDataSetLen
(
p
,
len
);
colDataAppend
(
pColInfo
,
0
,
p
,
false
);
colDataAppend
(
pColInfo
,
0
,
p
,
false
);
taosMemoryFree
(
p
);
taosMemoryFree
(
p
);
pBlock
->
info
.
rows
=
1
;
pBlock
->
info
.
rows
=
1
;
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
return
pBlock
;
return
pBlock
;
}
}
static
void
destroyBlockDistScanOperatorInfo
(
void
*
param
)
{
static
void
destroyBlockDistScanOperatorInfo
(
void
*
param
)
{
...
@@ -1928,7 +1928,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDi
...
@@ -1928,7 +1928,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDi
pInfo
->
readHandle
=
*
readHandle
;
pInfo
->
readHandle
=
*
readHandle
;
pInfo
->
uid
=
pBlockScanNode
->
suid
;
pInfo
->
uid
=
pBlockScanNode
->
suid
;
pInfo
->
pResBlock
=
create
ResDataBlock
(
pBlockScanNode
->
node
.
pOutputDataBlockDesc
);
pInfo
->
pResBlock
=
create
DataBlockFromDescNode
(
pBlockScanNode
->
node
.
pOutputDataBlockDesc
);
blockDataEnsureCapacity
(
pInfo
->
pResBlock
,
1
);
blockDataEnsureCapacity
(
pInfo
->
pResBlock
,
1
);
int32_t
numOfCols
=
0
;
int32_t
numOfCols
=
0
;
...
...
source/libs/executor/src/tfill.c
浏览文件 @
682b3b60
...
@@ -1092,7 +1092,7 @@ static bool checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t group
...
@@ -1092,7 +1092,7 @@ static bool checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t group
}
}
static
void
buildFillResult
(
SResultRowData
*
pResRow
,
SStreamFillSupporter
*
pFillSup
,
TSKEY
ts
,
SSDataBlock
*
pBlock
)
{
static
void
buildFillResult
(
SResultRowData
*
pResRow
,
SStreamFillSupporter
*
pFillSup
,
TSKEY
ts
,
SSDataBlock
*
pBlock
)
{
uint64_t
groupId
=
pBlock
->
info
.
groupId
;
uint64_t
groupId
=
pBlock
->
info
.
id
.
groupId
;
if
(
pFillSup
->
hasDelete
&&
!
checkResult
(
pFillSup
,
ts
,
groupId
))
{
if
(
pFillSup
->
hasDelete
&&
!
checkResult
(
pFillSup
,
ts
,
groupId
))
{
return
;
return
;
}
}
...
@@ -1131,7 +1131,7 @@ static void doStreamFillNormal(SStreamFillSupporter* pFillSup, SStreamFillInfo*
...
@@ -1131,7 +1131,7 @@ static void doStreamFillNormal(SStreamFillSupporter* pFillSup, SStreamFillInfo*
static
void
doStreamFillLinear
(
SStreamFillSupporter
*
pFillSup
,
SStreamFillInfo
*
pFillInfo
,
SSDataBlock
*
pBlock
)
{
static
void
doStreamFillLinear
(
SStreamFillSupporter
*
pFillSup
,
SStreamFillInfo
*
pFillInfo
,
SSDataBlock
*
pBlock
)
{
while
(
hasRemainCalc
(
pFillInfo
)
&&
pBlock
->
info
.
rows
<
pBlock
->
info
.
capacity
)
{
while
(
hasRemainCalc
(
pFillInfo
)
&&
pBlock
->
info
.
rows
<
pBlock
->
info
.
capacity
)
{
uint64_t
groupId
=
pBlock
->
info
.
groupId
;
uint64_t
groupId
=
pBlock
->
info
.
id
.
groupId
;
SWinKey
key
=
{.
groupId
=
groupId
,
.
ts
=
pFillInfo
->
current
};
SWinKey
key
=
{.
groupId
=
groupId
,
.
ts
=
pFillInfo
->
current
};
if
(
pFillSup
->
hasDelete
&&
!
checkResult
(
pFillSup
,
pFillInfo
->
current
,
groupId
))
{
if
(
pFillSup
->
hasDelete
&&
!
checkResult
(
pFillSup
,
pFillInfo
->
current
,
groupId
))
{
pFillInfo
->
current
=
taosTimeAdd
(
pFillInfo
->
current
,
pFillSup
->
interval
.
sliding
,
pFillSup
->
interval
.
slidingUnit
,
pFillInfo
->
current
=
taosTimeAdd
(
pFillInfo
->
current
,
pFillSup
->
interval
.
sliding
,
pFillSup
->
interval
.
slidingUnit
,
...
@@ -1230,7 +1230,7 @@ void keepBlockRowInDiscBuf(SOperatorInfo* pOperator, SStreamFillInfo* pFillInfo,
...
@@ -1230,7 +1230,7 @@ void keepBlockRowInDiscBuf(SOperatorInfo* pOperator, SStreamFillInfo* pFillInfo,
static
void
doFillResults
(
SOperatorInfo
*
pOperator
,
SStreamFillSupporter
*
pFillSup
,
SStreamFillInfo
*
pFillInfo
,
static
void
doFillResults
(
SOperatorInfo
*
pOperator
,
SStreamFillSupporter
*
pFillSup
,
SStreamFillInfo
*
pFillInfo
,
SSDataBlock
*
pBlock
,
TSKEY
*
tsCol
,
int32_t
rowId
,
SSDataBlock
*
pRes
)
{
SSDataBlock
*
pBlock
,
TSKEY
*
tsCol
,
int32_t
rowId
,
SSDataBlock
*
pRes
)
{
uint64_t
groupId
=
pBlock
->
info
.
groupId
;
uint64_t
groupId
=
pBlock
->
info
.
id
.
groupId
;
getWindowFromDiscBuf
(
pOperator
,
tsCol
[
rowId
],
groupId
,
pFillSup
);
getWindowFromDiscBuf
(
pOperator
,
tsCol
[
rowId
],
groupId
,
pFillSup
);
if
(
pFillSup
->
prev
.
key
==
pFillInfo
->
preRowKey
)
{
if
(
pFillSup
->
prev
.
key
==
pFillInfo
->
preRowKey
)
{
resetFillWindow
(
&
pFillSup
->
prev
);
resetFillWindow
(
&
pFillSup
->
prev
);
...
@@ -1245,9 +1245,9 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) {
...
@@ -1245,9 +1245,9 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) {
SStreamFillSupporter
*
pFillSup
=
pInfo
->
pFillSup
;
SStreamFillSupporter
*
pFillSup
=
pInfo
->
pFillSup
;
SStreamFillInfo
*
pFillInfo
=
pInfo
->
pFillInfo
;
SStreamFillInfo
*
pFillInfo
=
pInfo
->
pFillInfo
;
SSDataBlock
*
pBlock
=
pInfo
->
pSrcBlock
;
SSDataBlock
*
pBlock
=
pInfo
->
pSrcBlock
;
uint64_t
groupId
=
pBlock
->
info
.
groupId
;
uint64_t
groupId
=
pBlock
->
info
.
id
.
groupId
;
SSDataBlock
*
pRes
=
pInfo
->
pRes
;
SSDataBlock
*
pRes
=
pInfo
->
pRes
;
pRes
->
info
.
groupId
=
groupId
;
pRes
->
info
.
id
.
groupId
=
groupId
;
if
(
hasRemainCalc
(
pFillInfo
))
{
if
(
hasRemainCalc
(
pFillInfo
))
{
doStreamFillRange
(
pFillInfo
,
pFillSup
,
pRes
);
doStreamFillRange
(
pFillInfo
,
pFillSup
,
pRes
);
}
}
...
@@ -1282,7 +1282,9 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) {
...
@@ -1282,7 +1282,9 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) {
blockDataCleanup
(
pInfo
->
pSrcBlock
);
blockDataCleanup
(
pInfo
->
pSrcBlock
);
}
}
static
void
buildDeleteRange
(
TSKEY
start
,
TSKEY
end
,
uint64_t
groupId
,
SSDataBlock
*
delRes
)
{
static
void
buildDeleteRange
(
SOperatorInfo
*
pOp
,
TSKEY
start
,
TSKEY
end
,
uint64_t
groupId
,
SSDataBlock
*
delRes
)
{
SStreamState
*
pState
=
pOp
->
pTaskInfo
->
streamInfo
.
pState
;
SSDataBlock
*
pBlock
=
delRes
;
SSDataBlock
*
pBlock
=
delRes
;
SColumnInfoData
*
pStartCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pStartCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pEndCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pEndCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
...
@@ -1290,25 +1292,42 @@ static void buildDeleteRange(TSKEY start, TSKEY end, uint64_t groupId, SSDataBlo
...
@@ -1290,25 +1292,42 @@ static void buildDeleteRange(TSKEY start, TSKEY end, uint64_t groupId, SSDataBlo
SColumnInfoData
*
pGroupCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pGroupCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pCalStartCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalStartCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalEndCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalEndCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pTbNameCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
colDataAppend
(
pStartCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
start
,
false
);
colDataAppend
(
pStartCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
start
,
false
);
colDataAppend
(
pEndCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
end
,
false
);
colDataAppend
(
pEndCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
end
,
false
);
colDataAppendNULL
(
pUidCol
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pUidCol
,
pBlock
->
info
.
rows
);
colDataAppend
(
pGroupCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
groupId
,
false
);
colDataAppend
(
pGroupCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
&
groupId
,
false
);
colDataAppendNULL
(
pCalStartCol
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pCalStartCol
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pCalEndCol
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pCalEndCol
,
pBlock
->
info
.
rows
);
SColumnInfoData
*
pTableCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
void
*
tbname
=
NULL
;
streamStateGetParName
(
pOp
->
pTaskInfo
->
streamInfo
.
pState
,
groupId
,
&
tbname
);
if
(
tbname
==
NULL
)
{
colDataAppendNULL
(
pTableCol
,
pBlock
->
info
.
rows
);
}
else
{
char
parTbName
[
VARSTR_HEADER_SIZE
+
TSDB_TABLE_NAME_LEN
];
STR_WITH_MAXSIZE_TO_VARSTR
(
parTbName
,
tbname
,
sizeof
(
parTbName
));
colDataAppend
(
pTableCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
parTbName
,
false
);
}
tdbFree
(
tbname
);
pBlock
->
info
.
rows
++
;
pBlock
->
info
.
rows
++
;
}
}
static
void
buildDeleteResult
(
S
StreamFillSupporter
*
pFillSup
,
TSKEY
startTs
,
TSKEY
endTs
,
uint64_t
groupId
,
static
void
buildDeleteResult
(
S
OperatorInfo
*
pOperator
,
TSKEY
startTs
,
TSKEY
endTs
,
uint64_t
groupId
,
SSDataBlock
*
delRes
)
{
SSDataBlock
*
delRes
)
{
SStreamFillOperatorInfo
*
pInfo
=
pOperator
->
info
;
SStreamFillSupporter
*
pFillSup
=
pInfo
->
pFillSup
;
if
(
hasPrevWindow
(
pFillSup
))
{
if
(
hasPrevWindow
(
pFillSup
))
{
TSKEY
start
=
getNextWindowTs
(
pFillSup
->
prev
.
key
,
&
pFillSup
->
interval
);
TSKEY
start
=
getNextWindowTs
(
pFillSup
->
prev
.
key
,
&
pFillSup
->
interval
);
buildDeleteRange
(
start
,
endTs
,
groupId
,
delRes
);
buildDeleteRange
(
pOperator
,
start
,
endTs
,
groupId
,
delRes
);
}
else
if
(
hasNextWindow
(
pFillSup
))
{
}
else
if
(
hasNextWindow
(
pFillSup
))
{
TSKEY
end
=
getPrevWindowTs
(
pFillSup
->
next
.
key
,
&
pFillSup
->
interval
);
TSKEY
end
=
getPrevWindowTs
(
pFillSup
->
next
.
key
,
&
pFillSup
->
interval
);
buildDeleteRange
(
startTs
,
end
,
groupId
,
delRes
);
buildDeleteRange
(
pOperator
,
startTs
,
end
,
groupId
,
delRes
);
}
else
{
}
else
{
buildDeleteRange
(
startTs
,
endTs
,
groupId
,
delRes
);
buildDeleteRange
(
pOperator
,
startTs
,
endTs
,
groupId
,
delRes
);
}
}
}
}
...
@@ -1319,7 +1338,7 @@ static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKE
...
@@ -1319,7 +1338,7 @@ static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKE
SWinKey
key
=
{.
ts
=
startTs
,
.
groupId
=
groupId
};
SWinKey
key
=
{.
ts
=
startTs
,
.
groupId
=
groupId
};
if
(
!
pInfo
->
pFillInfo
->
needFill
)
{
if
(
!
pInfo
->
pFillInfo
->
needFill
)
{
streamStateFillDel
(
pOperator
->
pTaskInfo
->
streamInfo
.
pState
,
&
key
);
streamStateFillDel
(
pOperator
->
pTaskInfo
->
streamInfo
.
pState
,
&
key
);
buildDeleteResult
(
p
Info
->
pFillSup
,
startTs
,
endTs
,
groupId
,
pInfo
->
pDelRes
);
buildDeleteResult
(
p
Operator
,
startTs
,
endTs
,
groupId
,
pInfo
->
pDelRes
);
}
else
{
}
else
{
STimeRange
tw
=
{
STimeRange
tw
=
{
.
skey
=
startTs
,
.
skey
=
startTs
,
...
@@ -1342,14 +1361,14 @@ static void doDeleteFillFinalize(SOperatorInfo* pOperator) {
...
@@ -1342,14 +1361,14 @@ static void doDeleteFillFinalize(SOperatorInfo* pOperator) {
tSimpleHashClear
(
pInfo
->
pFillSup
->
pResMap
);
tSimpleHashClear
(
pInfo
->
pFillSup
->
pResMap
);
for
(;
pFillInfo
->
delIndex
<
size
;
pFillInfo
->
delIndex
++
)
{
for
(;
pFillInfo
->
delIndex
<
size
;
pFillInfo
->
delIndex
++
)
{
STimeRange
*
range
=
taosArrayGet
(
pFillInfo
->
delRanges
,
pFillInfo
->
delIndex
);
STimeRange
*
range
=
taosArrayGet
(
pFillInfo
->
delRanges
,
pFillInfo
->
delIndex
);
if
(
pInfo
->
pRes
->
info
.
groupId
!=
0
&&
pInfo
->
pRes
->
info
.
groupId
!=
range
->
groupId
)
{
if
(
pInfo
->
pRes
->
info
.
id
.
groupId
!=
0
&&
pInfo
->
pRes
->
info
.
id
.
groupId
!=
range
->
groupId
)
{
return
;
return
;
}
}
getWindowFromDiscBuf
(
pOperator
,
range
->
skey
,
range
->
groupId
,
pInfo
->
pFillSup
);
getWindowFromDiscBuf
(
pOperator
,
range
->
skey
,
range
->
groupId
,
pInfo
->
pFillSup
);
setDeleteFillValueInfo
(
range
->
skey
,
range
->
ekey
,
pInfo
->
pFillSup
,
pInfo
->
pFillInfo
);
setDeleteFillValueInfo
(
range
->
skey
,
range
->
ekey
,
pInfo
->
pFillSup
,
pInfo
->
pFillInfo
);
if
(
pInfo
->
pFillInfo
->
needFill
)
{
if
(
pInfo
->
pFillInfo
->
needFill
)
{
doStreamFillRange
(
pInfo
->
pFillInfo
,
pInfo
->
pFillSup
,
pInfo
->
pRes
);
doStreamFillRange
(
pInfo
->
pFillInfo
,
pInfo
->
pFillSup
,
pInfo
->
pRes
);
pInfo
->
pRes
->
info
.
groupId
=
range
->
groupId
;
pInfo
->
pRes
->
info
.
id
.
groupId
=
range
->
groupId
;
}
}
SWinKey
key
=
{.
ts
=
range
->
skey
,
.
groupId
=
range
->
groupId
};
SWinKey
key
=
{.
ts
=
range
->
skey
,
.
groupId
=
range
->
groupId
};
streamStateFillDel
(
pOperator
->
pTaskInfo
->
streamInfo
.
pState
,
&
key
);
streamStateFillDel
(
pOperator
->
pTaskInfo
->
streamInfo
.
pState
,
&
key
);
...
@@ -1435,7 +1454,7 @@ static void doApplyStreamScalarCalculation(SOperatorInfo* pOperator, SSDataBlock
...
@@ -1435,7 +1454,7 @@ static void doApplyStreamScalarCalculation(SOperatorInfo* pOperator, SSDataBlock
pSup
=
&
pInfo
->
pFillSup
->
notFillExprSup
;
pSup
=
&
pInfo
->
pFillSup
->
notFillExprSup
;
setInputDataBlock
(
pSup
,
pSrcBlock
,
TSDB_ORDER_ASC
,
MAIN_SCAN
,
false
);
setInputDataBlock
(
pSup
,
pSrcBlock
,
TSDB_ORDER_ASC
,
MAIN_SCAN
,
false
);
projectApplyFunctions
(
pSup
->
pExprInfo
,
pDstBlock
,
pSrcBlock
,
pSup
->
pCtx
,
pSup
->
numOfExprs
,
NULL
);
projectApplyFunctions
(
pSup
->
pExprInfo
,
pDstBlock
,
pSrcBlock
,
pSup
->
pCtx
,
pSup
->
numOfExprs
,
NULL
);
pDstBlock
->
info
.
groupId
=
pSrcBlock
->
info
.
groupId
;
pDstBlock
->
info
.
id
.
groupId
=
pSrcBlock
->
info
.
id
.
groupId
;
blockDataUpdateTsWindow
(
pDstBlock
,
pInfo
->
primaryTsCol
);
blockDataUpdateTsWindow
(
pDstBlock
,
pInfo
->
primaryTsCol
);
}
}
...
@@ -1578,7 +1597,7 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod
...
@@ -1578,7 +1597,7 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod
destroyStreamFillSupporter
(
pFillSup
);
destroyStreamFillSupporter
(
pFillSup
);
return
NULL
;
return
NULL
;
}
}
SExprInfo
*
noFillExpr
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
numOfNotFillCols
);
SExprInfo
*
noFillExpr
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
numOfNotFillCols
);
code
=
initExprSupp
(
&
pFillSup
->
notFillExprSup
,
noFillExpr
,
numOfNotFillCols
);
code
=
initExprSupp
(
&
pFillSup
->
notFillExprSup
,
noFillExpr
,
numOfNotFillCols
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -1651,9 +1670,9 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
...
@@ -1651,9 +1670,9 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
}
}
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
pInfo
->
pRes
=
create
ResDataBlock
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
pInfo
->
pRes
=
create
DataBlockFromDescNode
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
pInfo
->
pSrcBlock
=
create
ResDataBlock
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
pInfo
->
pSrcBlock
=
create
DataBlockFromDescNode
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
pInfo
->
pPrevSrcBlock
=
create
ResDataBlock
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
pInfo
->
pPrevSrcBlock
=
create
DataBlockFromDescNode
(
pPhyFillNode
->
node
.
pOutputDataBlockDesc
);
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
pSrcBlock
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
pSrcBlock
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
pPrevSrcBlock
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
pPrevSrcBlock
,
pOperator
->
resultInfo
.
capacity
);
...
@@ -1715,9 +1734,9 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
...
@@ -1715,9 +1734,9 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
}
}
pInfo
->
srcRowIndex
=
0
;
pInfo
->
srcRowIndex
=
0
;
setOperatorInfo
(
pOperator
,
"StreamFillOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
"StreamFillOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL
,
false
,
OP_NOT_OPENED
,
pInfo
,
pOperator
->
fpSet
=
pTaskInfo
);
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamFill
,
NULL
,
destroyStreamFillOperatorInfo
,
NULL
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamFill
,
NULL
,
destroyStreamFillOperatorInfo
,
NULL
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/executor/src/timesliceoperator.c
0 → 100644
浏览文件 @
682b3b60
此差异已折叠。
点击以展开。
source/libs/executor/src/timewindowoperator.c
浏览文件 @
682b3b60
此差异已折叠。
点击以展开。
source/libs/executor/src/tsort.c
浏览文件 @
682b3b60
...
@@ -417,8 +417,8 @@ int32_t msortComparFn(const void* pLeft, const void* pRight, void* param) {
...
@@ -417,8 +417,8 @@ int32_t msortComparFn(const void* pLeft, const void* pRight, void* param) {
SSDataBlock
*
pRightBlock
=
pRightSource
->
src
.
pBlock
;
SSDataBlock
*
pRightBlock
=
pRightSource
->
src
.
pBlock
;
if
(
pParam
->
cmpGroupId
)
{
if
(
pParam
->
cmpGroupId
)
{
if
(
pLeftBlock
->
info
.
groupId
!=
pRightBlock
->
info
.
groupId
)
{
if
(
pLeftBlock
->
info
.
id
.
groupId
!=
pRightBlock
->
info
.
id
.
groupId
)
{
return
pLeftBlock
->
info
.
groupId
<
pRightBlock
->
info
.
groupId
?
-
1
:
1
;
return
pLeftBlock
->
info
.
id
.
groupId
<
pRightBlock
->
info
.
id
.
groupId
?
-
1
:
1
;
}
}
}
}
...
@@ -826,7 +826,7 @@ void* tsortGetValue(STupleHandle* pVHandle, int32_t colIndex) {
...
@@ -826,7 +826,7 @@ void* tsortGetValue(STupleHandle* pVHandle, int32_t colIndex) {
}
}
}
}
uint64_t
tsortGetGroupId
(
STupleHandle
*
pVHandle
)
{
return
pVHandle
->
pBlock
->
info
.
groupId
;
}
uint64_t
tsortGetGroupId
(
STupleHandle
*
pVHandle
)
{
return
pVHandle
->
pBlock
->
info
.
id
.
groupId
;
}
SSortExecInfo
tsortGetSortExecInfo
(
SSortHandle
*
pHandle
)
{
SSortExecInfo
tsortGetSortExecInfo
(
SSortHandle
*
pHandle
)
{
SSortExecInfo
info
=
{
0
};
SSortExecInfo
info
=
{
0
};
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
682b3b60
此差异已折叠。
点击以展开。
source/libs/function/src/tudf.c
浏览文件 @
682b3b60
...
@@ -1096,7 +1096,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
...
@@ -1096,7 +1096,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
SSDataBlock
*
pTempBlock
=
createDataBlock
();
SSDataBlock
*
pTempBlock
=
createDataBlock
();
pTempBlock
->
info
.
rows
=
pInput
->
totalRows
;
pTempBlock
->
info
.
rows
=
pInput
->
totalRows
;
pTempBlock
->
info
.
uid
=
pInput
->
uid
;
pTempBlock
->
info
.
id
.
uid
=
pInput
->
uid
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
blockDataAppendColInfo
(
pTempBlock
,
pInput
->
pData
[
i
]);
blockDataAppendColInfo
(
pTempBlock
,
pInput
->
pData
[
i
]);
}
}
...
...
source/libs/index/test/index_executor_tests.cpp
浏览文件 @
682b3b60
...
@@ -78,7 +78,7 @@ void sifAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *sl
...
@@ -78,7 +78,7 @@ void sifAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *sl
blockDataEnsureCapacity
(
res
,
rows
);
blockDataEnsureCapacity
(
res
,
rows
);
*
dataBlockId
=
taosArrayGetSize
(
pBlockList
)
-
1
;
*
dataBlockId
=
taosArrayGetSize
(
pBlockList
)
-
1
;
res
->
info
.
blockId
=
*
dataBlockId
;
res
->
info
.
id
.
blockId
=
*
dataBlockId
;
*
slotId
=
0
;
*
slotId
=
0
;
}
else
{
}
else
{
SSDataBlock
*
res
=
*
(
SSDataBlock
**
)
taosArrayGetLast
(
pBlockList
);
SSDataBlock
*
res
=
*
(
SSDataBlock
**
)
taosArrayGetLast
(
pBlockList
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
682b3b60
...
@@ -654,7 +654,7 @@ cgroup_name(A) ::= NK_ID(B).
...
@@ -654,7 +654,7 @@ cgroup_name(A) ::= NK_ID(B).
/************************************************ expression **********************************************************/
/************************************************ expression **********************************************************/
expr_or_subquery(A) ::= expression(B). { A = B; }
expr_or_subquery(A) ::= expression(B). { A = B; }
expr_or_subquery(A) ::= subquery(B). { A = B
; }
//expr_or_subquery(A) ::= subquery(B). { A = createTempTableNode(pCxt, releaseRawExprNode(pCxt, B), NULL)
; }
expression(A) ::= literal(B). { A = B; }
expression(A) ::= literal(B). { A = B; }
expression(A) ::= pseudo_column(B). { A = B; }
expression(A) ::= pseudo_column(B). { A = B; }
...
...
source/libs/parser/src/parCalcConst.c
浏览文件 @
682b3b60
...
@@ -372,14 +372,42 @@ static bool isEmptyResultQuery(SNode* pStmt) {
...
@@ -372,14 +372,42 @@ static bool isEmptyResultQuery(SNode* pStmt) {
return
isEmptyResult
;
return
isEmptyResult
;
}
}
static
void
resetProjectNullTypeImpl
(
SNodeList
*
pProjects
)
{
SNode
*
pProj
=
NULL
;
FOREACH
(
pProj
,
pProjects
)
{
SExprNode
*
pExpr
=
(
SExprNode
*
)
pProj
;
if
(
TSDB_DATA_TYPE_NULL
==
pExpr
->
resType
.
type
)
{
pExpr
->
resType
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
pExpr
->
resType
.
bytes
=
0
;
}
}
}
static
void
resetProjectNullType
(
SNode
*
pStmt
)
{
switch
(
nodeType
(
pStmt
))
{
case
QUERY_NODE_SELECT_STMT
:
resetProjectNullTypeImpl
(((
SSelectStmt
*
)
pStmt
)
->
pProjectionList
);
break
;
case
QUERY_NODE_SET_OPERATOR
:
{
resetProjectNullTypeImpl
(((
SSetOperator
*
)
pStmt
)
->
pProjectionList
);
break
;
}
default:
break
;
}
}
int32_t
calculateConstant
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
)
{
int32_t
calculateConstant
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
)
{
SCalcConstContext
cxt
=
{.
pParseCxt
=
pParseCxt
,
SCalcConstContext
cxt
=
{.
pParseCxt
=
pParseCxt
,
.
msgBuf
.
buf
=
pParseCxt
->
pMsg
,
.
msgBuf
.
buf
=
pParseCxt
->
pMsg
,
.
msgBuf
.
len
=
pParseCxt
->
msgLen
,
.
msgBuf
.
len
=
pParseCxt
->
msgLen
,
.
code
=
TSDB_CODE_SUCCESS
};
.
code
=
TSDB_CODE_SUCCESS
};
int32_t
code
=
calcConstQuery
(
&
cxt
,
pQuery
->
pRoot
,
false
);
int32_t
code
=
calcConstQuery
(
&
cxt
,
pQuery
->
pRoot
,
false
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
isEmptyResultQuery
(
pQuery
->
pRoot
))
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pQuery
->
execMode
=
QUERY_EXEC_MODE_EMPTY_RESULT
;
resetProjectNullType
(
pQuery
->
pRoot
);
if
(
isEmptyResultQuery
(
pQuery
->
pRoot
))
{
pQuery
->
execMode
=
QUERY_EXEC_MODE_EMPTY_RESULT
;
}
}
}
return
code
;
return
code
;
}
}
source/libs/parser/src/sql.c
浏览文件 @
682b3b60
此差异已折叠。
点击以展开。
source/libs/scalar/src/scalar.c
浏览文件 @
682b3b60
...
@@ -378,7 +378,7 @@ int32_t sclInitParam(SNode *node, SScalarParam *param, SScalarCtx *ctx, int32_t
...
@@ -378,7 +378,7 @@ int32_t sclInitParam(SNode *node, SScalarParam *param, SScalarCtx *ctx, int32_t
int32_t
index
=
-
1
;
int32_t
index
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
ctx
->
pBlockList
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
ctx
->
pBlockList
);
++
i
)
{
SSDataBlock
*
pb
=
taosArrayGetP
(
ctx
->
pBlockList
,
i
);
SSDataBlock
*
pb
=
taosArrayGetP
(
ctx
->
pBlockList
,
i
);
if
(
pb
->
info
.
blockId
==
ref
->
dataBlockId
)
{
if
(
pb
->
info
.
id
.
blockId
==
ref
->
dataBlockId
)
{
index
=
i
;
index
=
i
;
break
;
break
;
}
}
...
@@ -1384,7 +1384,7 @@ EDealRes sclWalkTarget(SNode *pNode, SScalarCtx *ctx) {
...
@@ -1384,7 +1384,7 @@ EDealRes sclWalkTarget(SNode *pNode, SScalarCtx *ctx) {
int32_t
index
=
-
1
;
int32_t
index
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
ctx
->
pBlockList
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
ctx
->
pBlockList
);
++
i
)
{
SSDataBlock
*
pb
=
taosArrayGetP
(
ctx
->
pBlockList
,
i
);
SSDataBlock
*
pb
=
taosArrayGetP
(
ctx
->
pBlockList
,
i
);
if
(
pb
->
info
.
blockId
==
target
->
dataBlockId
)
{
if
(
pb
->
info
.
id
.
blockId
==
target
->
dataBlockId
)
{
index
=
i
;
index
=
i
;
break
;
break
;
}
}
...
...
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
682b3b60
...
@@ -98,7 +98,7 @@ void scltAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *s
...
@@ -98,7 +98,7 @@ void scltAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *s
taosArrayPush
(
pBlockList
,
&
res
);
taosArrayPush
(
pBlockList
,
&
res
);
*
dataBlockId
=
taosArrayGetSize
(
pBlockList
)
-
1
;
*
dataBlockId
=
taosArrayGetSize
(
pBlockList
)
-
1
;
res
->
info
.
blockId
=
*
dataBlockId
;
res
->
info
.
id
.
blockId
=
*
dataBlockId
;
*
slotId
=
0
;
*
slotId
=
0
;
}
else
{
}
else
{
SSDataBlock
*
res
=
*
(
SSDataBlock
**
)
taosArrayGetLast
(
pBlockList
);
SSDataBlock
*
res
=
*
(
SSDataBlock
**
)
taosArrayGetLast
(
pBlockList
);
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
682b3b60
...
@@ -463,7 +463,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
...
@@ -463,7 +463,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
continue
;
continue
;
}
}
if
(
streamSearchAndAddBlock
(
pTask
,
pReqs
,
pDataBlock
,
vgSz
,
pDataBlock
->
info
.
groupId
)
<
0
)
{
if
(
streamSearchAndAddBlock
(
pTask
,
pReqs
,
pDataBlock
,
vgSz
,
pDataBlock
->
info
.
id
.
groupId
)
<
0
)
{
goto
FAIL_SHUFFLE_DISPATCH
;
goto
FAIL_SHUFFLE_DISPATCH
;
}
}
}
}
...
...
source/libs/stream/src/streamUpdate.c
浏览文件 @
682b3b60
...
@@ -166,7 +166,7 @@ bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid) {
...
@@ -166,7 +166,7 @@ bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid) {
TSKEY
updateInfoFillBlockData
(
SUpdateInfo
*
pInfo
,
SSDataBlock
*
pBlock
,
int32_t
primaryTsCol
)
{
TSKEY
updateInfoFillBlockData
(
SUpdateInfo
*
pInfo
,
SSDataBlock
*
pBlock
,
int32_t
primaryTsCol
)
{
if
(
pBlock
==
NULL
||
pBlock
->
info
.
rows
==
0
)
return
INT64_MIN
;
if
(
pBlock
==
NULL
||
pBlock
->
info
.
rows
==
0
)
return
INT64_MIN
;
TSKEY
maxTs
=
INT64_MIN
;
TSKEY
maxTs
=
INT64_MIN
;
int64_t
tbUid
=
pBlock
->
info
.
uid
;
int64_t
tbUid
=
pBlock
->
info
.
id
.
uid
;
SColumnInfoData
*
pColDataInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
primaryTsCol
);
SColumnInfoData
*
pColDataInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
primaryTsCol
);
...
...
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
682b3b60
...
@@ -210,6 +210,7 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
...
@@ -210,6 +210,7 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
ret
=
tdbGetFileSize
(
pPager
->
fd
,
pPager
->
pageSize
,
&
(
pPager
->
dbOrigSize
));
ret
=
tdbGetFileSize
(
pPager
->
fd
,
pPager
->
pageSize
,
&
(
pPager
->
dbOrigSize
));
pPager
->
dbFileSize
=
pPager
->
dbOrigSize
;
pPager
->
dbFileSize
=
pPager
->
dbOrigSize
;
tdbTrace
(
"pager/open reset dirty tree: %p"
,
&
pPager
->
rbt
);
tRBTreeCreate
(
&
pPager
->
rbt
,
pageCmpFn
);
tRBTreeCreate
(
&
pPager
->
rbt
,
pageCmpFn
);
*
ppPager
=
pPager
;
*
ppPager
=
pPager
;
...
@@ -296,7 +297,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) {
...
@@ -296,7 +297,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) {
// ref page one more time so the page will not be release
// ref page one more time so the page will not be release
tdbRefPage
(
pPage
);
tdbRefPage
(
pPage
);
tdbDebug
(
"p
cache
/mdirty page %p/%d/%d"
,
pPage
,
TDB_PAGE_PGNO
(
pPage
),
pPage
->
id
);
tdbDebug
(
"p
ager
/mdirty page %p/%d/%d"
,
pPage
,
TDB_PAGE_PGNO
(
pPage
),
pPage
->
id
);
// Set page as dirty
// Set page as dirty
pPage
->
isDirty
=
1
;
pPage
->
isDirty
=
1
;
...
@@ -316,6 +317,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) {
...
@@ -316,6 +317,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) {
pPage->pDirtyNext = *ppPage;
pPage->pDirtyNext = *ppPage;
*ppPage = pPage;
*ppPage = pPage;
*/
*/
tdbTrace
(
"put page: %p %d to dirty tree: %p"
,
pPage
,
TDB_PAGE_PGNO
(
pPage
),
&
pPager
->
rbt
);
tRBTreePut
(
&
pPager
->
rbt
,
(
SRBTreeNode
*
)
pPage
);
tRBTreePut
(
&
pPager
->
rbt
,
(
SRBTreeNode
*
)
pPage
);
// Write page to journal if neccessary
// Write page to journal if neccessary
...
@@ -373,6 +375,7 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
...
@@ -373,6 +375,7 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
SRBTreeNode
*
pNode
=
NULL
;
SRBTreeNode
*
pNode
=
NULL
;
while
((
pNode
=
tRBTreeIterNext
(
&
iter
))
!=
NULL
)
{
while
((
pNode
=
tRBTreeIterNext
(
&
iter
))
!=
NULL
)
{
pPage
=
(
SPage
*
)
pNode
;
pPage
=
(
SPage
*
)
pNode
;
ASSERT
(
pPage
->
nOverflow
==
0
);
ASSERT
(
pPage
->
nOverflow
==
0
);
ret
=
tdbPagerWritePageToDB
(
pPager
,
pPage
);
ret
=
tdbPagerWritePageToDB
(
pPager
,
pPage
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
...
@@ -398,6 +401,7 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
...
@@ -398,6 +401,7 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
tdbPCacheRelease
(
pPager
->
pCache
,
pPage
,
pTxn
);
tdbPCacheRelease
(
pPager
->
pCache
,
pPage
,
pTxn
);
}
}
tdbTrace
(
"pager/commit reset dirty tree: %p"
,
&
pPager
->
rbt
);
tRBTreeCreate
(
&
pPager
->
rbt
,
pageCmpFn
);
tRBTreeCreate
(
&
pPager
->
rbt
,
pageCmpFn
);
// sync the db file
// sync the db file
...
@@ -471,6 +475,7 @@ int tdbPagerPrepareAsyncCommit(SPager *pPager, TXN *pTxn) {
...
@@ -471,6 +475,7 @@ int tdbPagerPrepareAsyncCommit(SPager *pPager, TXN *pTxn) {
tdbPCacheRelease
(
pPager
->
pCache
,
pPage
,
pTxn
);
tdbPCacheRelease
(
pPager
->
pCache
,
pPage
,
pTxn
);
}
}
/*
/*
tdbTrace("reset dirty tree: %p", &pPager->rbt);
tRBTreeCreate(&pPager->rbt, pageCmpFn);
tRBTreeCreate(&pPager->rbt, pageCmpFn);
// sync the db file
// sync the db file
...
@@ -566,6 +571,7 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) {
...
@@ -566,6 +571,7 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) {
tdbPCacheRelease
(
pPager
->
pCache
,
pPage
,
pTxn
);
tdbPCacheRelease
(
pPager
->
pCache
,
pPage
,
pTxn
);
}
}
tdbTrace
(
"reset dirty tree: %p"
,
&
pPager
->
rbt
);
tRBTreeCreate
(
&
pPager
->
rbt
,
pageCmpFn
);
tRBTreeCreate
(
&
pPager
->
rbt
,
pageCmpFn
);
// 4, remove the journal file
// 4, remove the journal file
...
@@ -580,6 +586,8 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) {
...
@@ -580,6 +586,8 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) {
int
tdbPagerFlushPage
(
SPager
*
pPager
,
TXN
*
pTxn
)
{
int
tdbPagerFlushPage
(
SPager
*
pPager
,
TXN
*
pTxn
)
{
SPage
*
pPage
;
SPage
*
pPage
;
i32
nRef
;
SPgno
maxPgno
=
pPager
->
dbOrigSize
;
int
ret
;
int
ret
;
// loop to write the dirty pages to file
// loop to write the dirty pages to file
...
@@ -587,29 +595,52 @@ int tdbPagerFlushPage(SPager *pPager, TXN *pTxn) {
...
@@ -587,29 +595,52 @@ int tdbPagerFlushPage(SPager *pPager, TXN *pTxn) {
SRBTreeNode
*
pNode
=
NULL
;
SRBTreeNode
*
pNode
=
NULL
;
while
((
pNode
=
tRBTreeIterNext
(
&
iter
))
!=
NULL
)
{
while
((
pNode
=
tRBTreeIterNext
(
&
iter
))
!=
NULL
)
{
pPage
=
(
SPage
*
)
pNode
;
pPage
=
(
SPage
*
)
pNode
;
nRef
=
tdbGetPageRef
(
pPage
);
if
(
nRef
>
1
)
{
continue
;
}
SPgno
pgno
=
TDB_PAGE_PGNO
(
pPage
);
if
(
pgno
>
maxPgno
)
{
maxPgno
=
pgno
;
}
ret
=
tdbPagerWritePageToDB
(
pPager
,
pPage
);
ret
=
tdbPagerWritePageToDB
(
pPager
,
pPage
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
tdbError
(
"failed to write page to db since %s"
,
tstrerror
(
terrno
));
tdbError
(
"failed to write page to db since %s"
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
}
tdbTrace
(
"tdbttl commit:%p, %d/%d"
,
pPager
,
pPager
->
dbOrigSize
,
pPager
->
dbFileSize
);
tdbTrace
(
"tdb/flush:%p, %d/%d/%d"
,
pPager
,
pPager
->
dbOrigSize
,
pPager
->
dbFileSize
,
maxPgno
);
pPager
->
dbOrigSize
=
pPager
->
dbFileSize
;
pPager
->
dbOrigSize
=
maxPgno
;
pPage
->
isDirty
=
0
;
tdbTrace
(
"pager/flush drop page: %p %d from dirty tree: %p"
,
pPage
,
TDB_PAGE_PGNO
(
pPage
),
&
pPager
->
rbt
);
tRBTreeDrop
(
&
pPager
->
rbt
,
(
SRBTreeNode
*
)
pPage
);
tdbPCacheRelease
(
pPager
->
pCache
,
pPage
,
pTxn
);
break
;
}
/*
tdbTrace("tdb/flush:%p, %d/%d/%d", pPager, pPager->dbOrigSize, pPager->dbFileSize, maxPgno);
pPager->dbOrigSize = maxPgno;
// release the page
// release the page
iter = tRBTreeIterCreate(&pPager->rbt, 1);
iter = tRBTreeIterCreate(&pPager->rbt, 1);
while ((pNode = tRBTreeIterNext(&iter)) != NULL) {
while ((pNode = tRBTreeIterNext(&iter)) != NULL) {
pPage = (SPage *)pNode;
pPage = (SPage *)pNode;
nRef = tdbGetPageRef(pPage);
if (nRef > 1) {
continue;
}
pPage->isDirty = 0;
pPage->isDirty = 0;
tdbTrace("pager/flush drop page: %p %d from dirty tree: %p", pPage, TDB_PAGE_PGNO(pPage), &pPager->rbt);
tRBTreeDrop(&pPager->rbt, (SRBTreeNode *)pPage);
tRBTreeDrop(&pPager->rbt, (SRBTreeNode *)pPage);
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
}
}
*/
tRBTreeCreate
(
&
pPager
->
rbt
,
pageCmpFn
);
return
0
;
return
0
;
}
}
...
...
source/util/src/trbtree.c
浏览文件 @
682b3b60
...
@@ -104,61 +104,6 @@ static void tRBTreeTransplant(SRBTree *pTree, SRBTreeNode *u, SRBTreeNode *v) {
...
@@ -104,61 +104,6 @@ static void tRBTreeTransplant(SRBTree *pTree, SRBTreeNode *u, SRBTreeNode *v) {
v
->
parent
=
u
->
parent
;
v
->
parent
=
u
->
parent
;
}
}
static
void
tRBTreeDropFix
(
SRBTree
*
pTree
,
SRBTreeNode
*
x
)
{
while
(
x
!=
pTree
->
root
&&
x
->
color
==
BLACK
)
{
if
(
x
==
x
->
parent
->
left
)
{
SRBTreeNode
*
w
=
x
->
parent
->
right
;
if
(
w
->
color
==
RED
)
{
w
->
color
=
BLACK
;
x
->
parent
->
color
=
RED
;
tRBTreeRotateLeft
(
pTree
,
x
->
parent
);
w
=
x
->
parent
->
right
;
}
if
(
w
->
left
->
color
==
BLACK
&&
w
->
right
->
color
==
BLACK
)
{
w
->
color
=
RED
;
x
=
x
->
parent
;
}
else
{
if
(
w
->
right
->
color
==
BLACK
)
{
w
->
left
->
color
=
BLACK
;
w
->
color
=
RED
;
tRBTreeRotateRight
(
pTree
,
w
);
w
=
x
->
parent
->
right
;
}
w
->
color
=
x
->
parent
->
color
;
x
->
parent
->
color
=
BLACK
;
w
->
right
->
color
=
BLACK
;
tRBTreeRotateLeft
(
pTree
,
x
->
parent
);
x
=
pTree
->
root
;
}
}
else
{
SRBTreeNode
*
w
=
x
->
parent
->
left
;
if
(
w
->
color
==
RED
)
{
w
->
color
=
BLACK
;
x
->
parent
->
color
=
RED
;
tRBTreeRotateRight
(
pTree
,
x
->
parent
);
w
=
x
->
parent
->
left
;
}
if
(
w
->
right
->
color
==
BLACK
&&
w
->
left
->
color
==
BLACK
)
{
w
->
color
=
RED
;
x
=
x
->
parent
;
}
else
{
if
(
w
->
left
->
color
==
BLACK
)
{
w
->
right
->
color
=
BLACK
;
w
->
color
=
RED
;
tRBTreeRotateLeft
(
pTree
,
w
);
w
=
x
->
parent
->
left
;
}
w
->
color
=
x
->
parent
->
color
;
x
->
parent
->
color
=
BLACK
;
w
->
left
->
color
=
BLACK
;
tRBTreeRotateRight
(
pTree
,
x
->
parent
);
x
=
pTree
->
root
;
}
}
}
x
->
color
=
BLACK
;
}
static
SRBTreeNode
*
tRBTreeSuccessor
(
SRBTree
*
pTree
,
SRBTreeNode
*
pNode
)
{
static
SRBTreeNode
*
tRBTreeSuccessor
(
SRBTree
*
pTree
,
SRBTreeNode
*
pNode
)
{
if
(
pNode
->
right
!=
pTree
->
NIL
)
{
if
(
pNode
->
right
!=
pTree
->
NIL
)
{
pNode
=
pNode
->
right
;
pNode
=
pNode
->
right
;
...
@@ -255,11 +200,205 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
...
@@ -255,11 +200,205 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
return
z
;
return
z
;
}
}
void
tRBTreeDrop
(
SRBTree
*
pTree
,
SRBTreeNode
*
z
)
{
#define RBTREE_NULL rbtree->NIL
SRBTreeNode
*
y
=
z
;
#define rbtree_t SRBTree
SRBTreeNode
*
x
;
#define rbnode_t SRBTreeNode
ECOLOR
y_orignal_color
=
y
->
color
;
#define rbtree_rotate_left tRBTreeRotateLeft
#define rbtree_rotate_right tRBTreeRotateRight
static
void
rbtree_delete_fixup
(
rbtree_t
*
rbtree
,
rbnode_t
*
child
,
rbnode_t
*
child_parent
)
{
rbnode_t
*
sibling
;
int
go_up
=
1
;
/* determine sibling to the node that is one-black short */
if
(
child_parent
->
right
==
child
)
sibling
=
child_parent
->
left
;
else
sibling
=
child_parent
->
right
;
while
(
go_up
)
{
if
(
child_parent
==
RBTREE_NULL
)
{
/* removed parent==black from root, every path, so ok */
return
;
}
if
(
sibling
->
color
==
RED
)
{
/* rotate to get a black sibling */
child_parent
->
color
=
RED
;
sibling
->
color
=
BLACK
;
if
(
child_parent
->
right
==
child
)
rbtree_rotate_right
(
rbtree
,
child_parent
);
else
rbtree_rotate_left
(
rbtree
,
child_parent
);
/* new sibling after rotation */
if
(
child_parent
->
right
==
child
)
sibling
=
child_parent
->
left
;
else
sibling
=
child_parent
->
right
;
}
if
(
child_parent
->
color
==
BLACK
&&
sibling
->
color
==
BLACK
&&
sibling
->
left
->
color
==
BLACK
&&
sibling
->
right
->
color
==
BLACK
)
{
/* fixup local with recolor of sibling */
if
(
sibling
!=
RBTREE_NULL
)
sibling
->
color
=
RED
;
child
=
child_parent
;
child_parent
=
child_parent
->
parent
;
/* prepare to go up, new sibling */
if
(
child_parent
->
right
==
child
)
sibling
=
child_parent
->
left
;
else
sibling
=
child_parent
->
right
;
}
else
go_up
=
0
;
}
if
(
child_parent
->
color
==
RED
&&
sibling
->
color
==
BLACK
&&
sibling
->
left
->
color
==
BLACK
&&
sibling
->
right
->
color
==
BLACK
)
{
/* move red to sibling to rebalance */
if
(
sibling
!=
RBTREE_NULL
)
sibling
->
color
=
RED
;
child_parent
->
color
=
BLACK
;
return
;
}
assert
(
sibling
!=
RBTREE_NULL
);
/* get a new sibling, by rotating at sibling. See which child
of sibling is red */
if
(
child_parent
->
right
==
child
&&
sibling
->
color
==
BLACK
&&
sibling
->
right
->
color
==
RED
&&
sibling
->
left
->
color
==
BLACK
)
{
sibling
->
color
=
RED
;
sibling
->
right
->
color
=
BLACK
;
rbtree_rotate_left
(
rbtree
,
sibling
);
/* new sibling after rotation */
if
(
child_parent
->
right
==
child
)
sibling
=
child_parent
->
left
;
else
sibling
=
child_parent
->
right
;
}
else
if
(
child_parent
->
left
==
child
&&
sibling
->
color
==
BLACK
&&
sibling
->
left
->
color
==
RED
&&
sibling
->
right
->
color
==
BLACK
)
{
sibling
->
color
=
RED
;
sibling
->
left
->
color
=
BLACK
;
rbtree_rotate_right
(
rbtree
,
sibling
);
/* new sibling after rotation */
if
(
child_parent
->
right
==
child
)
sibling
=
child_parent
->
left
;
else
sibling
=
child_parent
->
right
;
}
/* now we have a black sibling with a red child. rotate and exchange colors. */
sibling
->
color
=
child_parent
->
color
;
child_parent
->
color
=
BLACK
;
if
(
child_parent
->
right
==
child
)
{
assert
(
sibling
->
left
->
color
==
RED
);
sibling
->
left
->
color
=
BLACK
;
rbtree_rotate_right
(
rbtree
,
child_parent
);
}
else
{
assert
(
sibling
->
right
->
color
==
RED
);
sibling
->
right
->
color
=
BLACK
;
rbtree_rotate_left
(
rbtree
,
child_parent
);
}
}
/** helpers for delete: swap node colours */
static
void
swap_int8
(
ECOLOR
*
x
,
ECOLOR
*
y
)
{
ECOLOR
t
=
*
x
;
*
x
=
*
y
;
*
y
=
t
;
}
/** helpers for delete: swap node pointers */
static
void
swap_np
(
rbnode_t
**
x
,
rbnode_t
**
y
)
{
rbnode_t
*
t
=
*
x
;
*
x
=
*
y
;
*
y
=
t
;
}
/** Update parent pointers of child trees of 'parent' */
static
void
change_parent_ptr
(
rbtree_t
*
rbtree
,
rbnode_t
*
parent
,
rbnode_t
*
old
,
rbnode_t
*
new
)
{
if
(
parent
==
RBTREE_NULL
)
{
assert
(
rbtree
->
root
==
old
);
if
(
rbtree
->
root
==
old
)
rbtree
->
root
=
new
;
return
;
}
assert
(
parent
->
left
==
old
||
parent
->
right
==
old
||
parent
->
left
==
new
||
parent
->
right
==
new
);
if
(
parent
->
left
==
old
)
parent
->
left
=
new
;
if
(
parent
->
right
==
old
)
parent
->
right
=
new
;
}
/** Update parent pointer of a node 'child' */
static
void
change_child_ptr
(
rbtree_t
*
rbtree
,
rbnode_t
*
child
,
rbnode_t
*
old
,
rbnode_t
*
new
)
{
if
(
child
==
RBTREE_NULL
)
return
;
assert
(
child
->
parent
==
old
||
child
->
parent
==
new
);
if
(
child
->
parent
==
old
)
child
->
parent
=
new
;
}
rbnode_t
*
rbtree_delete
(
rbtree_t
*
rbtree
,
void
*
key
)
{
rbnode_t
*
to_delete
=
key
;
rbnode_t
*
child
;
/* make sure we have at most one non-leaf child */
if
(
to_delete
->
left
!=
RBTREE_NULL
&&
to_delete
->
right
!=
RBTREE_NULL
)
{
/* swap with smallest from right subtree (or largest from left) */
rbnode_t
*
smright
=
to_delete
->
right
;
while
(
smright
->
left
!=
RBTREE_NULL
)
smright
=
smright
->
left
;
/* swap the smright and to_delete elements in the tree,
* but the rbnode_t is first part of user data struct
* so cannot just swap the keys and data pointers. Instead
* readjust the pointers left,right,parent */
/* swap colors - colors are tied to the position in the tree */
swap_int8
(
&
to_delete
->
color
,
&
smright
->
color
);
/* swap child pointers in parents of smright/to_delete */
change_parent_ptr
(
rbtree
,
to_delete
->
parent
,
to_delete
,
smright
);
if
(
to_delete
->
right
!=
smright
)
change_parent_ptr
(
rbtree
,
smright
->
parent
,
smright
,
to_delete
);
/* swap parent pointers in children of smright/to_delete */
change_child_ptr
(
rbtree
,
smright
->
left
,
smright
,
to_delete
);
change_child_ptr
(
rbtree
,
smright
->
left
,
smright
,
to_delete
);
change_child_ptr
(
rbtree
,
smright
->
right
,
smright
,
to_delete
);
change_child_ptr
(
rbtree
,
smright
->
right
,
smright
,
to_delete
);
change_child_ptr
(
rbtree
,
to_delete
->
left
,
to_delete
,
smright
);
if
(
to_delete
->
right
!=
smright
)
change_child_ptr
(
rbtree
,
to_delete
->
right
,
to_delete
,
smright
);
if
(
to_delete
->
right
==
smright
)
{
/* set up so after swap they work */
to_delete
->
right
=
to_delete
;
smright
->
parent
=
smright
;
}
/* swap pointers in to_delete/smright nodes */
swap_np
(
&
to_delete
->
parent
,
&
smright
->
parent
);
swap_np
(
&
to_delete
->
left
,
&
smright
->
left
);
swap_np
(
&
to_delete
->
right
,
&
smright
->
right
);
/* now delete to_delete (which is at the location where the smright previously was) */
}
assert
(
to_delete
->
left
==
RBTREE_NULL
||
to_delete
->
right
==
RBTREE_NULL
);
if
(
to_delete
->
left
!=
RBTREE_NULL
)
child
=
to_delete
->
left
;
else
child
=
to_delete
->
right
;
/* unlink to_delete from the tree, replace to_delete with child */
change_parent_ptr
(
rbtree
,
to_delete
->
parent
,
to_delete
,
child
);
change_child_ptr
(
rbtree
,
child
,
to_delete
,
to_delete
->
parent
);
if
(
to_delete
->
color
==
RED
)
{
/* if node is red then the child (black) can be swapped in */
}
else
if
(
child
->
color
==
RED
)
{
/* change child to BLACK, removing a RED node is no problem */
if
(
child
!=
RBTREE_NULL
)
child
->
color
=
BLACK
;
}
else
rbtree_delete_fixup
(
rbtree
,
child
,
to_delete
->
parent
);
/* unlink completely */
to_delete
->
parent
=
RBTREE_NULL
;
to_delete
->
left
=
RBTREE_NULL
;
to_delete
->
right
=
RBTREE_NULL
;
to_delete
->
color
=
BLACK
;
return
to_delete
;
}
void
tRBTreeDrop
(
SRBTree
*
pTree
,
SRBTreeNode
*
z
)
{
// update min/max node
// update min/max node
if
(
pTree
->
min
==
z
)
{
if
(
pTree
->
min
==
z
)
{
pTree
->
min
=
tRBTreeSuccessor
(
pTree
,
pTree
->
min
);
pTree
->
min
=
tRBTreeSuccessor
(
pTree
,
pTree
->
min
);
...
@@ -268,34 +407,8 @@ void tRBTreeDrop(SRBTree *pTree, SRBTreeNode *z) {
...
@@ -268,34 +407,8 @@ void tRBTreeDrop(SRBTree *pTree, SRBTreeNode *z) {
pTree
->
max
=
tRBTreePredecessor
(
pTree
,
pTree
->
max
);
pTree
->
max
=
tRBTreePredecessor
(
pTree
,
pTree
->
max
);
}
}
// drop impl
rbtree_delete
(
pTree
,
z
);
if
(
z
->
left
==
pTree
->
NIL
)
{
x
=
z
->
right
;
tRBTreeTransplant
(
pTree
,
z
,
z
->
right
);
}
else
if
(
z
->
right
==
pTree
->
NIL
)
{
x
=
z
->
left
;
tRBTreeTransplant
(
pTree
,
z
,
z
->
left
);
}
else
{
y
=
tRBTreeSuccessor
(
pTree
,
z
);
y_orignal_color
=
y
->
color
;
x
=
y
->
right
;
if
(
y
->
parent
==
z
)
{
x
->
parent
=
z
;
}
else
{
tRBTreeTransplant
(
pTree
,
y
,
y
->
right
);
y
->
right
=
z
->
right
;
y
->
right
->
parent
=
y
;
}
tRBTreeTransplant
(
pTree
,
z
,
y
);
y
->
left
=
z
->
left
;
y
->
left
->
parent
=
y
;
y
->
color
=
z
->
color
;
}
// fix
if
(
y_orignal_color
==
BLACK
)
{
tRBTreeDropFix
(
pTree
,
x
);
}
pTree
->
n
--
;
pTree
->
n
--
;
}
}
...
@@ -343,4 +456,4 @@ SRBTreeNode *tRBTreeIterNext(SRBTreeIter *pIter) {
...
@@ -343,4 +456,4 @@ SRBTreeNode *tRBTreeIterNext(SRBTreeIter *pIter) {
_exit:
_exit:
return
(
pNode
==
pIter
->
pTree
->
NIL
)
?
NULL
:
pNode
;
return
(
pNode
==
pIter
->
pTree
->
NIL
)
?
NULL
:
pNode
;
}
}
\ No newline at end of file
tests/parallel_test/cases.task
浏览文件 @
682b3b60
...
@@ -90,7 +90,7 @@
...
@@ -90,7 +90,7 @@
,,y,script,./test.sh -f tsim/parser/auto_create_tb.sim
,,y,script,./test.sh -f tsim/parser/auto_create_tb.sim
,,y,script,./test.sh -f tsim/parser/between_and.sim
,,y,script,./test.sh -f tsim/parser/between_and.sim
,,y,script,./test.sh -f tsim/parser/binary_escapeCharacter.sim
,,y,script,./test.sh -f tsim/parser/binary_escapeCharacter.sim
,,y,script,./test.sh -f tsim/parser/col_arithmetic_operation.sim
,,y,script,./test.sh -f tsim/parser/col_arithmetic_operation.sim
,,y,script,./test.sh -f tsim/parser/columnValue_bigint.sim
,,y,script,./test.sh -f tsim/parser/columnValue_bigint.sim
,,y,script,./test.sh -f tsim/parser/columnValue_bool.sim
,,y,script,./test.sh -f tsim/parser/columnValue_bool.sim
,,y,script,./test.sh -f tsim/parser/columnValue_double.sim
,,y,script,./test.sh -f tsim/parser/columnValue_double.sim
...
@@ -409,7 +409,7 @@
...
@@ -409,7 +409,7 @@
,,n,system-test,python3 ./test.py -f 0-others/taosdShell.py -N 5 -M 3 -Q 3
,,n,system-test,python3 ./test.py -f 0-others/taosdShell.py -N 5 -M 3 -Q 3
,,n,system-test,python3 ./test.py -f 0-others/udfTest.py
,,n,system-test,python3 ./test.py -f 0-others/udfTest.py
,,n,system-test,python3 ./test.py -f 0-others/udf_create.py
,,n,system-test,python3 ./test.py -f 0-others/udf_create.py
,,
n,system-test,
python3 ./test.py -f 0-others/udf_restart_taosd.py
,,
y,system-test,./pytest.sh
python3 ./test.py -f 0-others/udf_restart_taosd.py
,,n,system-test,python3 ./test.py -f 0-others/udf_cfg1.py
,,n,system-test,python3 ./test.py -f 0-others/udf_cfg1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/udf_cfg2.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/udf_cfg2.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/cachemodel.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/cachemodel.py
...
@@ -425,7 +425,7 @@
...
@@ -425,7 +425,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_table.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_table.py
,,
n
,system-test,python3 ./test.py -f 1-insert/boundary.py
,,,system-test,python3 ./test.py -f 1-insert/boundary.py
,,n,system-test,python3 ./test.py -f 1-insert/insertWithMoreVgroup.py
,,n,system-test,python3 ./test.py -f 1-insert/insertWithMoreVgroup.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/table_comment.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/table_comment.py
,,n,system-test,python3 ./test.py -f 1-insert/time_range_wise.py
,,n,system-test,python3 ./test.py -f 1-insert/time_range_wise.py
...
@@ -633,41 +633,41 @@
...
@@ -633,41 +633,41 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/csum.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/csum.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_diff.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_diff.py
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode1mnode.py
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode1mnode.py
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode2mnode.py
-N 5
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode2mnode.py
-N 5
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -i False
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -i False
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 -i False
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 -i False
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 -n 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 -n 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3 -n 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3 -n 3
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py
-N 6 -M 3
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py
-N 6 -M 3
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py
-N 6 -M 3 -n 3
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py
-N 6 -M 3 -n 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3 -n 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3 -n 3
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py
-N 6 -M 3
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py
-N 6 -M 3
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py
-N 6 -M 3 -n 3
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py
-N 6 -M 3 -n 3
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py
-N 6 -M 3
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py
-N 6 -M 3
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3
-n 3
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3
-n 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 -n 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 -n 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6
,,
,system-test,
python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3
,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5
,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py
-N 5 -M 3
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py
-N 5 -M 3
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py
-N 5 -M 3
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py
-N 5 -M 3
,,
,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py
-N 5 -M 3
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py
-N 5 -M 3
,,
,system-test,python3
test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1
,,
y,system-test,./pytest.sh python3 ./
test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1
,,
,system-test,python3
test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -N 4 -M 1
,,
y,system-test,./pytest.sh python3 ./
test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -N 4 -M 1
,,
,system-test,python3
test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -N 4 -M 1
,,
y,system-test,./pytest.sh python3 ./
test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -N 4 -M 1
,,
,system-test,python3
test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -N 4 -M 1
,,
y,system-test,./pytest.sh python3 ./
test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -N 4 -M 1
,,
,system-test,python3
test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -N 4 -M 1
,,
y,system-test,./pytest.sh python3 ./
test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -N 4 -M 1
,,
,system-test,python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py
-N 4 -M 1
,,
y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py
-N 4 -M 1
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/basic5.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/basic5.py
...
@@ -702,19 +702,19 @@
...
@@ -702,19 +702,19 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py
,,
,system-test,
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py
,,
y,system-test,./pytest.sh
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart.py
,,
,system-test,
python3 ./test.py -f 7-tmq/tmqDnodeRestart1.py
,,
y,system-test,./pytest.sh
python3 ./test.py -f 7-tmq/tmqDnodeRestart1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py
,,
,system-test,
python3 ./test.py -f 7-tmq/tmqDropStb.py
,,
y,system-test,./pytest.sh
python3 ./test.py -f 7-tmq/tmqDropStb.py
,,
,system-test,
python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
,,
y,system-test,./pytest.sh
python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf.py
...
@@ -723,13 +723,13 @@
...
@@ -723,13 +723,13 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py
,,
,system-test,
python3 ./test.py -f 7-tmq/tmq_taosx.py
,,
y,system-test,./pytest.sh
python3 ./test.py -f 7-tmq/tmq_taosx.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-19201.py
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-19201.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -N 5
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -N 5
,,
,system-test,
python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3
,,
,system-test,
python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -n 3
,,
y,system-test,./pytest.sh
python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py
-Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/varchar.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/varchar.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ltrim.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ltrim.py -Q 2
...
...
tests/pytest/util/dnodes.py
浏览文件 @
682b3b60
...
@@ -823,5 +823,8 @@ class TDDnodes:
...
@@ -823,5 +823,8 @@ class TDDnodes:
def
addSimExtraCfg
(
self
,
option
,
value
):
def
addSimExtraCfg
(
self
,
option
,
value
):
self
.
sim
.
addExtraCfg
(
option
,
value
)
self
.
sim
.
addExtraCfg
(
option
,
value
)
def
getAsan
(
self
):
return
self
.
asan
tdDnodes
=
TDDnodes
()
tdDnodes
=
TDDnodes
()
tests/system-test/0-others/udf_cluster.py
浏览文件 @
682b3b60
...
@@ -259,6 +259,8 @@ class TDTestCase:
...
@@ -259,6 +259,8 @@ class TDTestCase:
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setAsan
(
tdDnodes
.
getAsan
())
self
.
TDDnodes
.
stopAll
()
self
.
TDDnodes
.
stopAll
()
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
...
...
tests/system-test/6-cluster/5dnode1mnode.py
浏览文件 @
682b3b60
...
@@ -7,6 +7,7 @@ import os
...
@@ -7,6 +7,7 @@ import os
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.dnodes
import
*
from
util.dnodes
import
TDDnodes
from
util.dnodes
import
TDDnodes
from
util.dnodes
import
TDDnode
from
util.dnodes
import
TDDnode
import
time
import
time
...
@@ -68,6 +69,8 @@ class TDTestCase:
...
@@ -68,6 +69,8 @@ class TDTestCase:
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setAsan
(
tdDnodes
.
getAsan
())
self
.
TDDnodes
.
stopAll
()
self
.
TDDnodes
.
stopAll
()
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
...
...
tests/system-test/6-cluster/5dnode3mnodeDrop.py
浏览文件 @
682b3b60
...
@@ -8,6 +8,7 @@ import os
...
@@ -8,6 +8,7 @@ import os
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.dnodes
import
*
from
util.dnodes
import
TDDnodes
from
util.dnodes
import
TDDnodes
from
util.dnodes
import
TDDnode
from
util.dnodes
import
TDDnode
import
time
import
time
...
@@ -94,6 +95,8 @@ class TDTestCase:
...
@@ -94,6 +95,8 @@ class TDTestCase:
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setAsan
(
tdDnodes
.
getAsan
())
self
.
TDDnodes
.
stopAll
()
self
.
TDDnodes
.
stopAll
()
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
...
@@ -249,6 +252,9 @@ class TDTestCase:
...
@@ -249,6 +252,9 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
1
,
4
,
'ready'
)
tdSql
.
checkData
(
2
,
4
,
'ready'
)
tdSql
.
checkData
(
3
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
query
(
"select * from information_schema.ins_mnodes;"
)
tdSql
.
query
(
"select * from information_schema.ins_mnodes;"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
...
...
tests/system-test/6-cluster/5dnode3mnodeDropInsert.py
浏览文件 @
682b3b60
...
@@ -159,6 +159,8 @@ class TDTestCase:
...
@@ -159,6 +159,8 @@ class TDTestCase:
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setAsan
(
tdDnodes
.
getAsan
())
self
.
TDDnodes
.
stopAll
()
self
.
TDDnodes
.
stopAll
()
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
...
...
tests/system-test/6-cluster/5dnode3mnodeStopInsert.py
浏览文件 @
682b3b60
...
@@ -117,6 +117,8 @@ class TDTestCase:
...
@@ -117,6 +117,8 @@ class TDTestCase:
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setValgrind
(
valgrind
)
self
.
TDDnodes
.
setAsan
(
tdDnodes
.
getAsan
())
self
.
TDDnodes
.
stopAll
()
self
.
TDDnodes
.
stopAll
()
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
...
...
tests/system-test/test-all.bat
浏览文件 @
682b3b60
...
@@ -90,7 +90,7 @@ goto :eof
...
@@ -90,7 +90,7 @@ goto :eof
:CheckSkipCase
:CheckSkipCase
set
skipCase
=
false
set
skipCase
=
false
if
"
%
*"
==
"python3 ./test.py -f 1-insert/insertWithMoreVgroup.py"
(
set
skipCase
=
tru
e
)
if
"
%
*"
==
"python3 ./test.py -f 1-insert/insertWithMoreVgroup.py"
(
set
skipCase
=
fals
e
)
if
"
%
*"
==
"python3 ./test.py -f 2-query/queryQnode.py"
(
set
skipCase
=
tru
e
)
if
"
%
*"
==
"python3 ./test.py -f 2-query/queryQnode.py"
(
set
skipCase
=
fals
e
)
echo
%
*
|
grep
"\-R"
&&
set
skipCase
=
true
echo
%
*
|
grep
"\-R"
&&
set
skipCase
=
true
:goto
eof
:goto
eof
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录