Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
bcc9d7bc
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bcc9d7bc
编写于
12月 12, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225] refactor.
上级
d9c09bde
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
19 deletion
+19
-19
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+3
-3
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+16
-16
未找到文件。
src/query/inc/qUtil.h
浏览文件 @
bcc9d7bc
...
...
@@ -24,6 +24,9 @@
#define GET_RES_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t))
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
#define GET_ROW_PARAM_FOR_MULTIOUTPUT(_q, tbq, sq) (((tbq) && (!sq))? (_q)->pExpr1[1].base.arg->argValue.i64:1)
int32_t
getOutputInterResultBufSize
(
SQuery
*
pQuery
);
void
clearResultRow
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SResultRow
*
pRow
,
int16_t
type
);
...
...
@@ -47,9 +50,6 @@ static FORCE_INLINE SResultRow *getResultRow(SResultRowInfo *pWindowResInfo, int
return
pWindowResInfo
->
pResult
[
slot
];
}
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
#define GET_ROW_PARAM_FOR_MULTIOUTPUT(_q, tbq, sq) (((tbq) && (!sq))? (_q)->pExpr1[1].base.arg->argValue.i64:1)
bool
isWindowResClosed
(
SResultRowInfo
*
pWindowResInfo
,
int32_t
slot
);
int32_t
initResultRow
(
SResultRow
*
pResultRow
);
...
...
src/query/src/qExecutor.c
浏览文件 @
bcc9d7bc
...
...
@@ -464,13 +464,13 @@ static bool hasNullValue(SColIndex* pColIndex, SDataStatis *pStatis, SDataStatis
return
true
;
}
static
SResultRow
*
doPrepareResultRowFromKey
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SResultRowInfo
*
p
WindowRes
Info
,
char
*
pData
,
static
SResultRow
*
doPrepareResultRowFromKey
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SResultRowInfo
*
p
ResultRow
Info
,
char
*
pData
,
int16_t
bytes
,
bool
masterscan
,
uint64_t
uid
)
{
SET_RES_WINDOW_KEY
(
pRuntimeEnv
->
keyBuf
,
pData
,
bytes
,
uid
);
int32_t
*
p1
=
(
int32_t
*
)
taosHashGet
(
pRuntimeEnv
->
pResultRowHashTable
,
pRuntimeEnv
->
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
bytes
));
if
(
p1
!=
NULL
)
{
p
WindowRes
Info
->
curIndex
=
*
p1
;
p
ResultRow
Info
->
curIndex
=
*
p1
;
}
else
{
if
(
!
masterscan
)
{
// not master scan, do not add new timewindow
return
NULL
;
...
...
@@ -478,46 +478,46 @@ static SResultRow *doPrepareResultRowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SRes
// TODO refactor
// more than the capacity, reallocate the resources
if
(
p
WindowResInfo
->
size
>=
pWindowRes
Info
->
capacity
)
{
if
(
p
ResultRowInfo
->
size
>=
pResultRow
Info
->
capacity
)
{
int64_t
newCapacity
=
0
;
if
(
p
WindowRes
Info
->
capacity
>
10000
)
{
newCapacity
=
(
int64_t
)(
p
WindowRes
Info
->
capacity
*
1
.
25
);
if
(
p
ResultRow
Info
->
capacity
>
10000
)
{
newCapacity
=
(
int64_t
)(
p
ResultRow
Info
->
capacity
*
1
.
25
);
}
else
{
newCapacity
=
(
int64_t
)(
p
WindowRes
Info
->
capacity
*
1
.
5
);
newCapacity
=
(
int64_t
)(
p
ResultRow
Info
->
capacity
*
1
.
5
);
}
char
*
t
=
realloc
(
p
WindowRes
Info
->
pResult
,
(
size_t
)(
newCapacity
*
POINTER_BYTES
));
char
*
t
=
realloc
(
p
ResultRow
Info
->
pResult
,
(
size_t
)(
newCapacity
*
POINTER_BYTES
));
if
(
t
==
NULL
)
{
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
p
WindowRes
Info
->
pResult
=
(
SResultRow
**
)
t
;
p
ResultRow
Info
->
pResult
=
(
SResultRow
**
)
t
;
int32_t
inc
=
(
int32_t
)
newCapacity
-
p
WindowRes
Info
->
capacity
;
memset
(
&
p
WindowResInfo
->
pResult
[
pWindowRes
Info
->
capacity
],
0
,
POINTER_BYTES
*
inc
);
int32_t
inc
=
(
int32_t
)
newCapacity
-
p
ResultRow
Info
->
capacity
;
memset
(
&
p
ResultRowInfo
->
pResult
[
pResultRow
Info
->
capacity
],
0
,
POINTER_BYTES
*
inc
);
p
WindowRes
Info
->
capacity
=
(
int32_t
)
newCapacity
;
p
ResultRow
Info
->
capacity
=
(
int32_t
)
newCapacity
;
}
SResultRow
*
pResult
=
getNewResultRow
(
pRuntimeEnv
->
pool
);
p
WindowResInfo
->
pResult
[
pWindowRes
Info
->
size
]
=
pResult
;
p
ResultRowInfo
->
pResult
[
pResultRow
Info
->
size
]
=
pResult
;
int32_t
ret
=
initResultRow
(
pResult
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
// add a new result set for a new group
p
WindowResInfo
->
curIndex
=
pWindowRes
Info
->
size
++
;
p
ResultRowInfo
->
curIndex
=
pResultRow
Info
->
size
++
;
taosHashPut
(
pRuntimeEnv
->
pResultRowHashTable
,
pRuntimeEnv
->
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
bytes
),
(
char
*
)
&
p
WindowRes
Info
->
curIndex
,
sizeof
(
int32_t
));
(
char
*
)
&
p
ResultRow
Info
->
curIndex
,
sizeof
(
int32_t
));
}
// too many time window in query
if
(
p
WindowRes
Info
->
size
>
MAX_INTERVAL_TIME_WINDOW
)
{
if
(
p
ResultRow
Info
->
size
>
MAX_INTERVAL_TIME_WINDOW
)
{
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW
);
}
return
getResultRow
(
p
WindowResInfo
,
pWindowRes
Info
->
curIndex
);
return
getResultRow
(
p
ResultRowInfo
,
pResultRow
Info
->
curIndex
);
}
// get the correct time window according to the handled timestamp
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录