Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d40f830b
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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,发现更多精彩内容 >>
提交
d40f830b
编写于
4月 16, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(query): optimize the data block load algorithm in table scan operator.
上级
59de47a7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
24 deletion
+25
-24
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+4
-7
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+3
-3
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+18
-14
未找到文件。
source/libs/executor/src/executorimpl.c
浏览文件 @
d40f830b
...
...
@@ -1093,13 +1093,6 @@ static void doSetInputDataBlock(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx,
// }
// }
// in case of the block distribution query, the inputBytes is not a constant value.
//pCtx[i].input.pData[0] = taosArrayGet(pBlock->pDataBlock, slotId);
//pCtx[i].input.totalRows = pBlock->info.rows;
//pCtx[i].input.numOfRows = pBlock->info.rows;
//pCtx[i].input.startRowIndex = 0;
// uint32_t status = aAggs[pCtx[i].functionId].status;
// if ((status & (FUNCSTATE_SELECTIVITY | FUNCSTATE_NEED_TS)) != 0) {
// SColumnInfoData* tsInfo = taosArrayGet(pBlock->pDataBlock, 0);
...
...
@@ -1754,6 +1747,10 @@ void setBlockStatisInfo(SqlFunctionCtx* pCtx, SExprInfo* pExprInfo, SSDataBlock*
pInput
->
colDataAggIsSet
=
true
;
pInput
->
numOfRows
=
pBlock
->
info
.
rows
;
pInput
->
totalRows
=
pBlock
->
info
.
rows
;
// Here we set the column info data since the data type for each column data is required, but
// the data in the corresponding SColumnInfoData will not be used.
pInput
->
pData
[
j
]
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
}
}
}
else
{
...
...
source/libs/function/src/builtins.c
浏览文件 @
d40f830b
...
...
@@ -399,7 +399,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"sum"
,
.
type
=
FUNCTION_TYPE_SUM
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SPECIAL_DATA_REQUIRED
,
.
translateFunc
=
translateSum
,
.
dataRequiredFunc
=
statisDataRequired
,
.
getEnvFunc
=
getSumFuncEnv
,
...
...
@@ -410,7 +410,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"min"
,
.
type
=
FUNCTION_TYPE_MIN
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SPECIAL_DATA_REQUIRED
,
.
translateFunc
=
translateInOutNum
,
.
dataRequiredFunc
=
statisDataRequired
,
.
getEnvFunc
=
getMinmaxFuncEnv
,
...
...
@@ -421,7 +421,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"max"
,
.
type
=
FUNCTION_TYPE_MAX
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SPECIAL_DATA_REQUIRED
,
.
translateFunc
=
translateInOutNum
,
.
dataRequiredFunc
=
statisDataRequired
,
.
getEnvFunc
=
getMinmaxFuncEnv
,
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
d40f830b
...
...
@@ -361,20 +361,15 @@ int32_t doMinMaxHelper(SqlFunctionCtx *pCtx, int32_t isMinFunc) {
index
=
pInput
->
pColumnDataAgg
[
0
]
->
maxIndex
;
}
TSKEY
key
=
TSKEY_INITIAL_VAL
;
if
(
pCtx
->
ptsList
!=
NULL
)
{
// the index is the original position, not the relative position
key
=
pCtx
->
ptsList
[
index
];
}
// the index is the original position, not the relative position
TSKEY
key
=
(
pCtx
->
ptsList
!=
NULL
)
?
pCtx
->
ptsList
[
index
]
:
TSKEY_INITIAL_VAL
;
if
(
IS_SIGNED_NUMERIC_TYPE
(
type
))
{
int64_t
val
=
GET_INT64_VAL
(
tval
);
#if defined(_DEBUG_VIEW)
qDebug
(
"max value updated according to pre-cal:%d"
,
*
data
);
#endif
int64_t
prev
=
0
;
GET_TYPED_DATA
(
prev
,
int64_t
,
type
,
buf
);
if
((
*
(
int64_t
*
)
buf
<
val
)
^
isMinFunc
)
{
int64_t
val
=
GET_INT64_VAL
(
tval
);
if
((
prev
<
val
)
^
isMinFunc
)
{
*
(
int64_t
*
)
buf
=
val
;
for
(
int32_t
i
=
0
;
i
<
(
pCtx
)
->
subsidiaryRes
.
numOfCols
;
++
i
)
{
SqlFunctionCtx
*
__ctx
=
pCtx
->
subsidiaryRes
.
pCtx
[
i
];
...
...
@@ -387,14 +382,23 @@ int32_t doMinMaxHelper(SqlFunctionCtx *pCtx, int32_t isMinFunc) {
}
}
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
type
))
{
uint64_t
prev
=
0
;
GET_TYPED_DATA
(
prev
,
uint64_t
,
type
,
buf
);
uint64_t
val
=
GET_UINT64_VAL
(
tval
);
UPDATE_DATA
(
pCtx
,
*
(
uint64_t
*
)
buf
,
val
,
numOfElems
,
isMinFunc
,
key
);
UPDATE_DATA
(
pCtx
,
prev
,
val
,
numOfElems
,
isMinFunc
,
key
);
}
else
if
(
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
prev
=
0
;
GET_TYPED_DATA
(
prev
,
double
,
type
,
buf
);
double
val
=
GET_DOUBLE_VAL
(
tval
);
UPDATE_DATA
(
pCtx
,
*
(
double
*
)
buf
,
val
,
numOfElems
,
isMinFunc
,
key
);
UPDATE_DATA
(
pCtx
,
prev
,
val
,
numOfElems
,
isMinFunc
,
key
);
}
else
if
(
type
==
TSDB_DATA_TYPE_FLOAT
)
{
float
prev
=
0
;
GET_TYPED_DATA
(
prev
,
float
,
type
,
buf
);
double
val
=
GET_DOUBLE_VAL
(
tval
);
UPDATE_DATA
(
pCtx
,
*
(
float
*
)
buf
,
(
float
)
val
,
numOfElems
,
isMinFunc
,
key
);
UPDATE_DATA
(
pCtx
,
prev
,
(
float
)
val
,
numOfElems
,
isMinFunc
,
key
);
}
return
numOfElems
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录