Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
TDengine
提交
75984ed3
TDengine
项目概览
lzh_me
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
75984ed3
编写于
2月 18, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2895] refactor
上级
51db5f57
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
233 addition
and
183 deletion
+233
-183
src/query/inc/qAggMain.h
src/query/inc/qAggMain.h
+2
-2
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+18
-9
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+19
-19
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+194
-153
未找到文件。
src/query/inc/qAggMain.h
浏览文件 @
75984ed3
...
...
@@ -214,7 +214,7 @@ typedef struct SAggFunctionInfo {
void
(
*
xFinalize
)(
SQLFunctionCtx
*
pCtx
);
void
(
*
mergeFunc
)(
SQLFunctionCtx
*
pCtx
);
int32_t
(
*
dataReqFunc
)(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
);
int32_t
(
*
dataReqFunc
)(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
);
}
SAggFunctionInfo
;
#define GET_RES_INFO(ctx) ((ctx)->resultInfo)
...
...
@@ -247,7 +247,7 @@ extern struct SAggFunctionInfo aAggs[];
extern
int32_t
functionCompatList
[];
// compatible check array list
bool
topbot_datablock_filter
(
SQLFunctionCtx
*
pCtx
,
int32_t
functionId
,
const
char
*
minval
,
const
char
*
maxval
);
bool
topbot_datablock_filter
(
SQLFunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
);
/**
* the numOfRes should be kept, since it may be used later
...
...
src/query/inc/qExecutor.h
浏览文件 @
75984ed3
...
...
@@ -249,6 +249,7 @@ typedef struct SOperatorInfo {
int32_t
numOfOutput
;
__operator_fn_t
exec
;
__operator_fn_t
cleanup
;
struct
SOperatorInfo
*
upstream
;
}
SOperatorInfo
;
...
...
@@ -292,11 +293,6 @@ typedef struct SQueryRuntimeEnv {
SGroupResInfo
groupResInfo
;
}
SQueryRuntimeEnv
;
typedef
struct
{
char
*
name
;
void
*
info
;
}
SQEStage
;
enum
{
QUERY_RESULT_NOT_READY
=
1
,
QUERY_RESULT_READY
=
2
,
...
...
@@ -345,11 +341,11 @@ typedef struct SQueryParam {
typedef
struct
STableScanInfo
{
SQueryRuntimeEnv
*
pRuntimeEnv
;
void
*
pQueryHandle
;
int32_t
numOfBlocks
;
int32_t
numOfSkipped
;
int32_t
numOfBlockStatis
;
int64_t
numOfRows
;
int32_t
order
;
// scan order
...
...
@@ -359,11 +355,16 @@ typedef struct STableScanInfo {
int32_t
reverseTimes
;
// 0 by default
SSDataBlock
block
;
SQLFunctionCtx
*
pCtx
;
// next operator query context
SResultRowInfo
*
pResultRowInfo
;
int32_t
numOfOutput
;
int64_t
elapsedTime
;
}
STableScanInfo
;
typedef
struct
SAggOperatorInfo
{
SResultRowInfo
*
pR
esultRowInfo
;
SResultRowInfo
r
esultRowInfo
;
STableQueryInfo
*
pTableQueryInfo
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
SQLFunctionCtx
*
pCtx
;
...
...
@@ -372,7 +373,9 @@ typedef struct SAggOperatorInfo {
typedef
struct
SArithOperatorInfo
{
STableQueryInfo
*
pTableQueryInfo
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
SQLFunctionCtx
*
pCtx
;
SQLFunctionCtx
*
pCtx
;
SResultRowInfo
resultRowInfo
;
SSDataBlock
*
pOutput
;
}
SArithOperatorInfo
;
typedef
struct
SLimitOperatorInfo
{
...
...
@@ -388,10 +391,10 @@ typedef struct SOffsetOperatorInfo {
}
SOffsetOperatorInfo
;
typedef
struct
SHashIntervalOperatorInfo
{
SResultRowInfo
*
pResultRowInfo
;
STableQueryInfo
*
pTableQueryInfo
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
SQLFunctionCtx
*
pCtx
;
SResultRowInfo
resultRowInfo
;
}
SHashIntervalOperatorInfo
;
typedef
struct
SFillOperatorInfo
{
...
...
@@ -400,6 +403,12 @@ typedef struct SFillOperatorInfo {
SQueryRuntimeEnv
*
pRuntimeEnv
;
}
SFillOperatorInfo
;
typedef
struct
SFilterOperatorInfo
{
SResultRowInfo
*
pResultRowInfo
;
STableQueryInfo
*
pTableQueryInfo
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
}
SFilterOperatorInfo
;
void
freeParam
(
SQueryParam
*
param
);
int32_t
convertQueryMsg
(
SQueryTableMsg
*
pQueryMsg
,
SQueryParam
*
param
);
int32_t
createQueryFuncExprFromMsg
(
SQueryTableMsg
*
pQueryMsg
,
int32_t
numOfOutput
,
SExprInfo
**
pExprInfo
,
SSqlFuncMsg
**
pExprMsg
,
...
...
src/query/src/qAggMain.c
浏览文件 @
75984ed3
...
...
@@ -457,7 +457,7 @@ static void count_func_merge(SQLFunctionCtx *pCtx) {
* @param filterCols
* @return
*/
int32_t
count
_load_data_info
(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
)
{
int32_t
count
Required
(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
)
{
if
(
colId
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
return
BLK_DATA_NO_NEEDED
;
}
else
{
...
...
@@ -465,7 +465,7 @@ int32_t count_load_data_info(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, int32
}
}
int32_t
no
_data_info
(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
)
{
int32_t
no
DataRequired
(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
)
{
return
BLK_DATA_NO_NEEDED
;
}
...
...
@@ -667,16 +667,16 @@ static void sum_func_merge(SQLFunctionCtx *pCtx) {
}
}
static
int32_t
statisRequired
(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
)
{
static
int32_t
statisRequired
(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
)
{
return
BLK_DATA_STATIS_NEEDED
;
}
static
int32_t
dataBlockRequired
(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
)
{
static
int32_t
dataBlockRequired
(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
)
{
return
BLK_DATA_ALL_NEEDED
;
}
// todo: if
column in current data block are null, opt for this case
static
int32_t
firstFuncRequired
(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
)
{
// todo: if column in current data block are null, opt for this case
static
int32_t
firstFuncRequired
(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
)
{
if
(
pCtx
->
order
==
TSDB_ORDER_DESC
)
{
return
BLK_DATA_NO_NEEDED
;
}
...
...
@@ -689,7 +689,7 @@ static int32_t firstFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, i
}
}
static
int32_t
lastFuncRequired
(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
)
{
static
int32_t
lastFuncRequired
(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
)
{
if
(
pCtx
->
order
!=
pCtx
->
param
[
0
].
i64
)
{
return
BLK_DATA_NO_NEEDED
;
}
...
...
@@ -701,7 +701,7 @@ static int32_t lastFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, in
}
}
static
int32_t
firstDistFuncRequired
(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
)
{
static
int32_t
firstDistFuncRequired
(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
)
{
if
(
pCtx
->
order
==
TSDB_ORDER_DESC
)
{
return
BLK_DATA_NO_NEEDED
;
}
...
...
@@ -717,11 +717,11 @@ static int32_t firstDistFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY en
if
(
pInfo
->
hasResult
!=
DATA_SET_FLAG
)
{
return
BLK_DATA_ALL_NEEDED
;
}
else
{
// data in current block is not earlier than current result
return
(
pInfo
->
ts
<=
start
)
?
BLK_DATA_NO_NEEDED
:
BLK_DATA_ALL_NEEDED
;
return
(
pInfo
->
ts
<=
w
->
skey
)
?
BLK_DATA_NO_NEEDED
:
BLK_DATA_ALL_NEEDED
;
}
}
static
int32_t
lastDistFuncRequired
(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
)
{
static
int32_t
lastDistFuncRequired
(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
)
{
if
(
pCtx
->
order
!=
pCtx
->
param
[
0
].
i64
)
{
return
BLK_DATA_NO_NEEDED
;
}
...
...
@@ -737,7 +737,7 @@ static int32_t lastDistFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end
if
(
pInfo
->
hasResult
!=
DATA_SET_FLAG
)
{
return
BLK_DATA_ALL_NEEDED
;
}
else
{
return
(
pInfo
->
ts
>
end
)
?
BLK_DATA_NO_NEEDED
:
BLK_DATA_ALL_NEEDED
;
return
(
pInfo
->
ts
>
w
->
ekey
)
?
BLK_DATA_NO_NEEDED
:
BLK_DATA_ALL_NEEDED
;
}
}
...
...
@@ -2412,7 +2412,7 @@ static STopBotInfo *getTopBotOutputInfo(SQLFunctionCtx *pCtx) {
}
}
bool
topbot_datablock_filter
(
SQLFunctionCtx
*
pCtx
,
int32_t
functionId
,
const
char
*
minval
,
const
char
*
maxval
)
{
bool
topbot_datablock_filter
(
SQLFunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
)
{
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
if
(
pResInfo
==
NULL
)
{
return
true
;
...
...
@@ -2427,7 +2427,7 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, int32_t functionId, const cha
tValuePair
**
pRes
=
(
tValuePair
**
)
pTopBotInfo
->
res
;
if
(
functionId
==
TSDB_FUNC_TOP
)
{
if
(
pCtx
->
functionId
==
TSDB_FUNC_TOP
)
{
switch
(
pCtx
->
inputType
)
{
case
TSDB_DATA_TYPE_TINYINT
:
return
GET_INT8_VAL
(
maxval
)
>
pRes
[
0
]
->
v
.
i64
;
...
...
@@ -4549,7 +4549,7 @@ SAggFunctionInfo aAggs[] = {{
no_next_step
,
doFinalizer
,
count_func_merge
,
count
_load_data_info
,
count
Required
,
},
{
// 1
...
...
@@ -4734,7 +4734,7 @@ SAggFunctionInfo aAggs[] = {{
no_next_step
,
spread_function_finalizer
,
spread_func_merge
,
count
_load_data_info
,
count
Required
,
},
{
// 14
...
...
@@ -4776,7 +4776,7 @@ SAggFunctionInfo aAggs[] = {{
no_next_step
,
doFinalizer
,
copy_function
,
no
_data_info
,
no
DataRequired
,
},
{
// 17
...
...
@@ -4804,7 +4804,7 @@ SAggFunctionInfo aAggs[] = {{
no_next_step
,
doFinalizer
,
copy_function
,
no
_data_info
,
no
DataRequired
,
},
{
// 19
...
...
@@ -4832,7 +4832,7 @@ SAggFunctionInfo aAggs[] = {{
no_next_step
,
doFinalizer
,
copy_function
,
no
_data_info
,
no
DataRequired
,
},
{
// 21, column project sql function
...
...
@@ -4860,7 +4860,7 @@ SAggFunctionInfo aAggs[] = {{
no_next_step
,
doFinalizer
,
copy_function
,
no
_data_info
,
no
DataRequired
,
},
{
// 23
...
...
src/query/src/qExecutor.c
浏览文件 @
75984ed3
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录