Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5be04aa8
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5be04aa8
编写于
11月 03, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225]refactors.
上级
7bd533bf
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
22 deletion
+21
-22
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+21
-22
未找到文件。
src/query/src/qExecutor.c
浏览文件 @
5be04aa8
...
...
@@ -447,7 +447,7 @@ static bool hasNullValue(SColIndex* pColIndex, SDataStatis *pStatis, SDataStatis
return
true
;
}
static
SResultRow
*
do
SetTimeWind
owFromKey
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
,
char
*
pData
,
static
SResultRow
*
do
PrepareResultR
owFromKey
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
,
char
*
pData
,
int16_t
bytes
,
bool
masterscan
,
uint64_t
uid
)
{
SET_RES_WINDOW_KEY
(
pRuntimeEnv
->
keyBuf
,
pData
,
bytes
,
uid
);
int32_t
*
p1
=
...
...
@@ -601,8 +601,8 @@ static int32_t setWindowOutputBufByKey(SQueryRuntimeEnv *pRuntimeEnv, SWindowRes
assert
(
win
->
skey
<=
win
->
ekey
);
SDiskbasedResultBuf
*
pResultBuf
=
pRuntimeEnv
->
pResultBuf
;
SResultRow
*
p
WindowRes
=
doSetTimeWind
owFromKey
(
pRuntimeEnv
,
pWindowResInfo
,
(
char
*
)
&
win
->
skey
,
TSDB_KEYSIZE
,
masterscan
,
pBockInfo
->
uid
);
if
(
p
WindowRes
==
NULL
)
{
SResultRow
*
p
ResultRow
=
doPrepareResultR
owFromKey
(
pRuntimeEnv
,
pWindowResInfo
,
(
char
*
)
&
win
->
skey
,
TSDB_KEYSIZE
,
masterscan
,
pBockInfo
->
uid
);
if
(
p
ResultRow
==
NULL
)
{
*
newWind
=
false
;
return
masterscan
?
-
1
:
0
;
...
...
@@ -611,17 +611,16 @@ static int32_t setWindowOutputBufByKey(SQueryRuntimeEnv *pRuntimeEnv, SWindowRes
*
newWind
=
true
;
// not assign result buffer yet, add new result buffer
if
(
p
WindowRes
->
pageId
==
-
1
)
{
int32_t
ret
=
addNewWindowResultBuf
(
p
WindowRes
,
pResultBuf
,
pBockInfo
->
tid
,
pRuntimeEnv
->
numOfRowsPerPage
);
if
(
p
ResultRow
->
pageId
==
-
1
)
{
int32_t
ret
=
addNewWindowResultBuf
(
p
ResultRow
,
pResultBuf
,
pBockInfo
->
tid
,
pRuntimeEnv
->
numOfRowsPerPage
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
-
1
;
}
}
// set time window for current result
pWindowRes
->
win
=
(
*
win
);
setWindowResOutputBufInitCtx
(
pRuntimeEnv
,
pWindowRes
);
pResultRow
->
win
=
(
*
win
);
setWindowResOutputBufInitCtx
(
pRuntimeEnv
,
pResultRow
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1111,8 +1110,8 @@ static int32_t setGroupResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, char *pDat
}
uint64_t
uid
=
groupIndex
;
// uid is always set to be 0.
SResultRow
*
p
WindowRes
=
doSetTimeWind
owFromKey
(
pRuntimeEnv
,
&
pRuntimeEnv
->
windowResInfo
,
d
,
len
,
true
,
uid
);
if
(
p
WindowRes
==
NULL
)
{
SResultRow
*
p
ResultRow
=
doPrepareResultR
owFromKey
(
pRuntimeEnv
,
&
pRuntimeEnv
->
windowResInfo
,
d
,
len
,
true
,
uid
);
if
(
p
ResultRow
==
NULL
)
{
return
-
1
;
}
...
...
@@ -1126,21 +1125,21 @@ static int32_t setGroupResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, char *pDat
}
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
p
WindowRes
->
key
=
malloc
(
varDataTLen
(
pData
));
varDataCopy
(
p
WindowRes
->
key
,
pData
);
p
ResultRow
->
key
=
malloc
(
varDataTLen
(
pData
));
varDataCopy
(
p
ResultRow
->
key
,
pData
);
}
else
{
p
WindowRes
->
win
.
skey
=
v
;
p
WindowRes
->
win
.
ekey
=
v
;
p
ResultRow
->
win
.
skey
=
v
;
p
ResultRow
->
win
.
ekey
=
v
;
}
if
(
p
WindowRes
->
pageId
==
-
1
)
{
int32_t
ret
=
addNewWindowResultBuf
(
p
WindowRes
,
pResultBuf
,
GROUPRESULTID
,
pRuntimeEnv
->
numOfRowsPerPage
);
if
(
p
ResultRow
->
pageId
==
-
1
)
{
int32_t
ret
=
addNewWindowResultBuf
(
p
ResultRow
,
pResultBuf
,
GROUPRESULTID
,
pRuntimeEnv
->
numOfRowsPerPage
);
if
(
ret
!=
0
)
{
return
-
1
;
}
}
setResultOutputBuf
(
pRuntimeEnv
,
p
WindowRes
);
setResultOutputBuf
(
pRuntimeEnv
,
p
ResultRow
);
initCtxOutputBuf
(
pRuntimeEnv
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -3755,9 +3754,9 @@ void setExecutionContext(SQInfo *pQInfo, int32_t groupIndex, TSKEY nextKey) {
}
uint64_t
uid
=
0
;
// uid is always set to be 0
SResultRow
*
p
WindowRes
=
doSetTimeWind
owFromKey
(
pRuntimeEnv
,
pWindowResInfo
,
(
char
*
)
&
groupIndex
,
SResultRow
*
p
ResultRow
=
doPrepareResultR
owFromKey
(
pRuntimeEnv
,
pWindowResInfo
,
(
char
*
)
&
groupIndex
,
sizeof
(
groupIndex
),
true
,
uid
);
if
(
p
WindowRes
==
NULL
)
{
if
(
p
ResultRow
==
NULL
)
{
return
;
}
...
...
@@ -3765,8 +3764,8 @@ void setExecutionContext(SQInfo *pQInfo, int32_t groupIndex, TSKEY nextKey) {
* not assign result buffer yet, add new result buffer
* all group belong to one result set, and each group result has different group id so set the id to be one
*/
if
(
p
WindowRes
->
pageId
==
-
1
)
{
if
(
addNewWindowResultBuf
(
p
WindowRes
,
pRuntimeEnv
->
pResultBuf
,
groupIndex
,
pRuntimeEnv
->
numOfRowsPerPage
)
!=
if
(
p
ResultRow
->
pageId
==
-
1
)
{
if
(
addNewWindowResultBuf
(
p
ResultRow
,
pRuntimeEnv
->
pResultBuf
,
groupIndex
,
pRuntimeEnv
->
numOfRowsPerPage
)
!=
TSDB_CODE_SUCCESS
)
{
return
;
}
...
...
@@ -3774,7 +3773,7 @@ void setExecutionContext(SQInfo *pQInfo, int32_t groupIndex, TSKEY nextKey) {
// record the current active group id
pRuntimeEnv
->
prevGroupId
=
groupIndex
;
setResultOutputBuf
(
pRuntimeEnv
,
p
WindowRes
);
setResultOutputBuf
(
pRuntimeEnv
,
p
ResultRow
);
initCtxOutputBuf
(
pRuntimeEnv
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录