Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cdf2d3f4
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
cdf2d3f4
编写于
6月 02, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-4111]<fix>: fix bug for irate function.
上级
e0b4bb24
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
60 addition
and
219 deletion
+60
-219
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+7
-7
src/query/inc/qAggMain.h
src/query/inc/qAggMain.h
+12
-18
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+41
-177
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+0
-17
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
cdf2d3f4
...
...
@@ -2144,10 +2144,6 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
case
TSDB_FUNC_AVG
:
case
TSDB_FUNC_RATE
:
case
TSDB_FUNC_IRATE
:
case
TSDB_FUNC_SUM_RATE
:
case
TSDB_FUNC_SUM_IRATE
:
case
TSDB_FUNC_AVG_RATE
:
case
TSDB_FUNC_AVG_IRATE
:
case
TSDB_FUNC_TWA
:
case
TSDB_FUNC_MIN
:
case
TSDB_FUNC_MAX
:
...
...
@@ -2212,8 +2208,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
SExprInfo
*
pExpr
=
tscExprAppend
(
pQueryInfo
,
functionId
,
&
index
,
resultType
,
resultSize
,
getNewResColId
(
pCmd
),
resultSize
,
false
);
if
(
functionId
==
TSDB_FUNC_LEASTSQR
)
{
/* set the leastsquares parameters */
if
(
functionId
==
TSDB_FUNC_LEASTSQR
)
{
// set the leastsquares parameters
char
val
[
8
]
=
{
0
};
if
(
tVariantDump
(
&
pParamElem
[
1
].
pNode
->
value
,
val
,
TSDB_DATA_TYPE_DOUBLE
,
true
)
<
0
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
...
...
@@ -2227,6 +2222,11 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
tscExprAddParams
(
&
pExpr
->
base
,
val
,
TSDB_DATA_TYPE_DOUBLE
,
sizeof
(
double
));
}
else
if
(
functionId
==
TSDB_FUNC_IRATE
)
{
STableComInfo
info
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
int64_t
prec
=
info
.
precision
;
tscExprAddParams
(
&
pExpr
->
base
,
(
char
*
)
&
prec
,
TSDB_DATA_TYPE_BIGINT
,
LONG_BYTES
);
}
SColumnList
ids
=
createColumnList
(
1
,
index
.
tableIndex
,
index
.
columnIndex
);
...
...
@@ -2875,7 +2875,7 @@ int32_t tscTansformFuncForSTableQuery(SQueryInfo* pQueryInfo) {
if
((
functionId
>=
TSDB_FUNC_SUM
&&
functionId
<=
TSDB_FUNC_TWA
)
||
(
functionId
>=
TSDB_FUNC_FIRST_DST
&&
functionId
<=
TSDB_FUNC_STDDEV_DST
)
||
(
functionId
>=
TSDB_FUNC_RATE
&&
functionId
<=
TSDB_FUNC_
AVG_
IRATE
))
{
(
functionId
>=
TSDB_FUNC_RATE
&&
functionId
<=
TSDB_FUNC_IRATE
))
{
if
(
getResultDataInfo
(
pSrcSchema
->
type
,
pSrcSchema
->
bytes
,
functionId
,
(
int32_t
)
pExpr
->
base
.
param
[
0
].
i64
,
&
type
,
&
bytes
,
&
interBytes
,
0
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
...
...
src/query/inc/qAggMain.h
浏览文件 @
cdf2d3f4
...
...
@@ -65,24 +65,18 @@ extern "C" {
#define TSDB_FUNC_RATE 29
#define TSDB_FUNC_IRATE 30
#define TSDB_FUNC_SUM_RATE 31
#define TSDB_FUNC_SUM_IRATE 32
#define TSDB_FUNC_AVG_RATE 33
#define TSDB_FUNC_AVG_IRATE 34
#define TSDB_FUNC_TID_TAG 35
#define TSDB_FUNC_BLKINFO 36
#define TSDB_FUNC_HISTOGRAM 37
#define TSDB_FUNC_HLL 38
#define TSDB_FUNC_MODE 39
#define TSDB_FUNC_SAMPLE 40
#define TSDB_FUNC_CEIL 41
#define TSDB_FUNC_FLOOR 42
#define TSDB_FUNC_ROUND 43
#define TSDB_FUNC_MAVG 44
#define TSDB_FUNC_CSUM 45
#define TSDB_FUNC_TID_TAG 31
#define TSDB_FUNC_BLKINFO 32
#define TSDB_FUNC_HISTOGRAM 33
#define TSDB_FUNC_HLL 34
#define TSDB_FUNC_MODE 35
#define TSDB_FUNC_SAMPLE 36
#define TSDB_FUNC_CEIL 37
#define TSDB_FUNC_FLOOR 38
#define TSDB_FUNC_ROUND 39
#define TSDB_FUNC_MAVG 40
#define TSDB_FUNC_CSUM 41
#define TSDB_FUNCSTATE_SO 0x1u // single output
#define TSDB_FUNCSTATE_MO 0x2u // dynamic number of output, not multinumber of output e.g., TOP/BOTTOM
...
...
src/query/src/qAggMain.c
浏览文件 @
cdf2d3f4
...
...
@@ -159,8 +159,6 @@ typedef struct SRateInfo {
TSKEY
lastKey
;
int8_t
hasResult
;
// flag to denote has value
bool
isIRate
;
// true for IRate functions, false for Rate functions
int64_t
num
;
// for sum/avg
double
sum
;
// for sum/avg
}
SRateInfo
;
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
int16_t
*
type
,
...
...
@@ -238,7 +236,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
functionId
>=
TSDB_FUNC_RATE
&&
functionId
<=
TSDB_FUNC_
AVG_
IRATE
)
{
}
else
if
(
functionId
>=
TSDB_FUNC_RATE
&&
functionId
<=
TSDB_FUNC_IRATE
)
{
*
type
=
TSDB_DATA_TYPE_DOUBLE
;
*
bytes
=
sizeof
(
SRateInfo
);
*
interBytes
=
sizeof
(
SRateInfo
);
...
...
@@ -304,7 +302,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*
type
=
TSDB_DATA_TYPE_DOUBLE
;
*
bytes
=
sizeof
(
double
);
*
interBytes
=
sizeof
(
SAvgInfo
);
}
else
if
(
functionId
>=
TSDB_FUNC_RATE
&&
functionId
<=
TSDB_FUNC_
AVG_
IRATE
)
{
}
else
if
(
functionId
>=
TSDB_FUNC_RATE
&&
functionId
<=
TSDB_FUNC_IRATE
)
{
*
type
=
TSDB_DATA_TYPE_DOUBLE
;
*
bytes
=
sizeof
(
double
);
*
interBytes
=
sizeof
(
SRateInfo
);
...
...
@@ -4479,16 +4477,18 @@ static void ts_comp_finalize(SQLFunctionCtx *pCtx) {
}
//////////////////////////////////////////////////////////////////////////////////////////////
//
RATE
functions
static
double
do_calc_rate
(
const
SRateInfo
*
pRateInfo
)
{
if
((
INT64_MIN
==
pRateInfo
->
lastKey
)
||
(
INT64_MIN
==
pRateInfo
->
firstKey
)
||
(
pRateInfo
->
firstKey
>=
pRateInfo
->
lastKey
))
{
//
rate
functions
static
double
do_calc_rate
(
const
SRateInfo
*
pRateInfo
,
int64_t
tickPerSec
)
{
if
((
INT64_MIN
==
pRateInfo
->
lastKey
)
||
(
INT64_MIN
==
pRateInfo
->
firstKey
)
||
(
pRateInfo
->
firstKey
>=
pRateInfo
->
lastKey
))
{
return
0
;
}
int64_t
diff
=
0
;
if
(
pRateInfo
->
isIRate
)
{
// If the previous value of the last is greater than the last value, only keep the last point instead of the delta
// value between two values.
diff
=
pRateInfo
->
lastValue
;
if
(
diff
>=
pRateInfo
->
firstValue
)
{
diff
-=
pRateInfo
->
firstValue
;
...
...
@@ -4501,14 +4501,11 @@ static double do_calc_rate(const SRateInfo* pRateInfo) {
}
int64_t
duration
=
pRateInfo
->
lastKey
-
pRateInfo
->
firstKey
;
duration
=
(
duration
+
500
)
/
1000
;
double
resultVal
=
((
double
)
diff
)
/
duration
;
qDebug
(
"do_calc_rate() isIRate:%d firstKey:%"
PRId64
" lastKey:%"
PRId64
" firstValue:%"
PRId64
" lastValue:%"
PRId64
" CorrectionValue:%"
PRId64
" resultVal:%f"
,
pRateInfo
->
isIRate
,
pRateInfo
->
firstKey
,
pRateInfo
->
lastKey
,
pRateInfo
->
firstValue
,
pRateInfo
->
lastValue
,
pRateInfo
->
CorrectionValue
,
resultVal
);
return
resultVal
;
if
(
duration
==
0
)
{
return
0
;
}
return
(
duration
>
0
)
?
((
double
)
diff
)
/
(
duration
/
((
double
)
tickPerSec
))
:
0
;
}
static
bool
rate_function_setup
(
SQLFunctionCtx
*
pCtx
)
{
...
...
@@ -4516,19 +4513,17 @@ static bool rate_function_setup(SQLFunctionCtx *pCtx) {
return
false
;
}
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
//->pOutput + pCtx->outputBytes;
SRateInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
pResInfo
);
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SRateInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
pResInfo
);
pInfo
->
CorrectionValue
=
0
;
pInfo
->
firstKey
=
INT64_MIN
;
pInfo
->
lastKey
=
INT64_MIN
;
pInfo
->
firstValue
=
INT64_MIN
;
pInfo
->
lastValue
=
INT64_MIN
;
pInfo
->
num
=
0
;
pInfo
->
sum
=
0
;
pInfo
->
hasResult
=
0
;
pInfo
->
isIRate
=
(
(
pCtx
->
functionId
==
TSDB_FUNC_IRATE
)
||
(
pCtx
->
functionId
==
TSDB_FUNC_SUM_IRATE
)
||
(
pCtx
->
functionId
==
TSDB_FUNC_AVG_IRATE
)
);
pInfo
->
isIRate
=
(
pCtx
->
functionId
==
TSDB_FUNC_IRATE
);
return
true
;
}
...
...
@@ -4647,18 +4642,13 @@ static void rate_finalizer(SQLFunctionCtx *pCtx) {
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SRateInfo
*
pRateInfo
=
(
SRateInfo
*
)
GET_ROWCELL_INTERBUF
(
pResInfo
);
qDebug
(
"%p isIRate:%d firstKey:%"
PRId64
" lastKey:%"
PRId64
" firstValue:%"
PRId64
" lastValue:%"
PRId64
" CorrectionValue:%"
PRId64
" hasResult:%d"
,
pCtx
,
pRateInfo
->
isIRate
,
pRateInfo
->
firstKey
,
pRateInfo
->
lastKey
,
pRateInfo
->
firstValue
,
pRateInfo
->
lastValue
,
pRateInfo
->
CorrectionValue
,
pRateInfo
->
hasResult
);
if
(
pRateInfo
->
hasResult
!=
DATA_SET_FLAG
)
{
setNull
(
pCtx
->
pOutput
,
TSDB_DATA_TYPE_DOUBLE
,
sizeof
(
double
));
return
;
}
*
(
double
*
)
pCtx
->
pOutput
=
do_calc_rate
(
pRateInfo
);
qDebug
(
"rate_finalizer() output result:%f"
,
*
(
double
*
)
pCtx
->
pOutput
);
*
(
double
*
)
pCtx
->
pOutput
=
do_calc_rate
(
pRateInfo
,
TSDB_TICK_PER_SECOND
(
pCtx
->
param
[
0
].
i64
));
// cannot set the numOfIteratedElems again since it is set during previous iteration
pResInfo
->
numOfRes
=
1
;
pResInfo
->
hasResult
=
DATA_SET_FLAG
;
...
...
@@ -4667,22 +4657,15 @@ static void rate_finalizer(SQLFunctionCtx *pCtx) {
}
static
void
irate_function
(
SQLFunctionCtx
*
pCtx
)
{
int32_t
notNullElems
=
0
;
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SRateInfo
*
pRateInfo
=
(
SRateInfo
*
)
GET_ROWCELL_INTERBUF
(
pResInfo
);
TSKEY
*
primaryKey
=
GET_TS_LIST
(
pCtx
);
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
qDebug
(
"%p irate_function() size:%d, hasNull:%d"
,
pCtx
,
pCtx
->
size
,
pCtx
->
hasNull
);
if
(
pCtx
->
size
<
1
)
{
return
;
}
int32_t
notNullElems
=
0
;
SRateInfo
*
pRateInfo
=
(
SRateInfo
*
)
GET_ROWCELL_INTERBUF
(
pResInfo
);
TSKEY
*
primaryKey
=
GET_TS_LIST
(
pCtx
);
for
(
int32_t
i
=
pCtx
->
size
-
1
;
i
>=
0
;
--
i
)
{
char
*
pData
=
GET_INPUT_DATA
(
pCtx
,
i
);
if
(
pCtx
->
hasNull
&&
isNull
(
pData
,
pCtx
->
inputType
))
{
qDebug
(
"%p irate_function() index of null data:%d"
,
pCtx
,
i
);
continue
;
}
...
...
@@ -4690,21 +4673,16 @@ static void irate_function(SQLFunctionCtx *pCtx) {
int64_t
v
=
0
;
GET_TYPED_DATA
(
v
,
int64_t
,
pCtx
->
inputType
,
pData
);
// TODO: calc once if only call this function once ????
if
((
INT64_MIN
==
pRateInfo
->
lastKey
)
||
(
INT64_MIN
==
pRateInfo
->
lastValue
))
{
if
((
INT64_MIN
==
pRateInfo
->
lastKey
)
||
primaryKey
[
i
]
>
pRateInfo
->
lastKey
)
{
pRateInfo
->
lastValue
=
v
;
pRateInfo
->
lastKey
=
primaryKey
[
i
];
qDebug
(
"%p irate_function() lastValue:%"
PRId64
" lastKey:%"
PRId64
,
pCtx
,
pRateInfo
->
lastValue
,
pRateInfo
->
lastKey
);
continue
;
}
if
((
INT64_MIN
==
pRateInfo
->
firstKey
)
||
(
INT64_MIN
==
pRateInfo
->
firstValue
))
{
if
((
INT64_MIN
==
pRateInfo
->
firstKey
)
||
primaryKey
[
i
]
>
pRateInfo
->
firstKey
)
{
pRateInfo
->
firstValue
=
v
;
pRateInfo
->
firstKey
=
primaryKey
[
i
];
qDebug
(
"%p irate_function() firstValue:%"
PRId64
" firstKey:%"
PRId64
,
pCtx
,
pRateInfo
->
firstValue
,
pRateInfo
->
firstKey
);
break
;
}
}
...
...
@@ -4756,68 +4734,6 @@ static void irate_function_f(SQLFunctionCtx *pCtx, int32_t index) {
}
}
static
void
do_sumrate_merge
(
SQLFunctionCtx
*
pCtx
)
{
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
assert
(
pCtx
->
stableQuery
);
SRateInfo
*
pRateInfo
=
(
SRateInfo
*
)
GET_ROWCELL_INTERBUF
(
pResInfo
);
char
*
input
=
GET_INPUT_DATA_LIST
(
pCtx
);
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
,
input
+=
pCtx
->
inputBytes
)
{
SRateInfo
*
pInput
=
(
SRateInfo
*
)
input
;
qDebug
(
"%p do_sumrate_merge() hasResult:%d input num:%"
PRId64
" input sum:%f total num:%"
PRId64
" total sum:%f"
,
pCtx
,
pInput
->
hasResult
,
pInput
->
num
,
pInput
->
sum
,
pRateInfo
->
num
,
pRateInfo
->
sum
);
if
(
pInput
->
hasResult
!=
DATA_SET_FLAG
)
{
continue
;
}
else
if
(
pInput
->
num
==
0
)
{
pRateInfo
->
sum
+=
do_calc_rate
(
pInput
);
pRateInfo
->
num
++
;
}
else
{
pRateInfo
->
sum
+=
pInput
->
sum
;
pRateInfo
->
num
+=
pInput
->
num
;
}
pRateInfo
->
hasResult
=
DATA_SET_FLAG
;
}
// if the data set hasResult is not set, the result is null
if
(
DATA_SET_FLAG
==
pRateInfo
->
hasResult
)
{
pResInfo
->
hasResult
=
DATA_SET_FLAG
;
SET_VAL
(
pCtx
,
pRateInfo
->
num
,
1
);
memcpy
(
pCtx
->
pOutput
,
GET_ROWCELL_INTERBUF
(
pResInfo
),
sizeof
(
SRateInfo
));
}
}
static
void
sumrate_func_merge
(
SQLFunctionCtx
*
pCtx
)
{
qDebug
(
"%p sumrate_func_merge() process ..."
,
pCtx
);
do_sumrate_merge
(
pCtx
);
}
static
void
sumrate_finalizer
(
SQLFunctionCtx
*
pCtx
)
{
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SRateInfo
*
pRateInfo
=
(
SRateInfo
*
)
GET_ROWCELL_INTERBUF
(
pResInfo
);
qDebug
(
"%p sumrate_finalizer() superTableQ:%d num:%"
PRId64
" sum:%f hasResult:%d"
,
pCtx
,
pCtx
->
stableQuery
,
pRateInfo
->
num
,
pRateInfo
->
sum
,
pRateInfo
->
hasResult
);
if
(
pRateInfo
->
hasResult
!=
DATA_SET_FLAG
)
{
setNull
(
pCtx
->
pOutput
,
TSDB_DATA_TYPE_DOUBLE
,
sizeof
(
double
));
return
;
}
if
(
pRateInfo
->
num
==
0
)
{
// from meter
*
(
double
*
)
pCtx
->
pOutput
=
do_calc_rate
(
pRateInfo
);
}
else
if
(
pCtx
->
functionId
==
TSDB_FUNC_SUM_RATE
||
pCtx
->
functionId
==
TSDB_FUNC_SUM_IRATE
)
{
*
(
double
*
)
pCtx
->
pOutput
=
pRateInfo
->
sum
;
}
else
{
*
(
double
*
)
pCtx
->
pOutput
=
pRateInfo
->
sum
/
pRateInfo
->
num
;
}
pResInfo
->
numOfRes
=
1
;
pResInfo
->
hasResult
=
DATA_SET_FLAG
;
doFinalizer
(
pCtx
);
}
void
blockInfo_func
(
SQLFunctionCtx
*
pCtx
)
{
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
STableBlockDist
*
pDist
=
(
STableBlockDist
*
)
GET_ROWCELL_INTERBUF
(
pResInfo
);
...
...
@@ -4987,8 +4903,8 @@ int32_t functionCompatList[] = {
4
,
-
1
,
-
1
,
1
,
1
,
1
,
1
,
1
,
1
,
-
1
,
// tag, colprj, tagprj, arithmetic, diff, first_dist, last_dist, interp rate irate
1
,
1
,
1
,
1
,
-
1
,
1
,
1
,
5
,
1
,
1
,
//
sum_rate, sum_irate, avg_rate, avg_irate,
tid_tag, blk_info
1
,
1
,
1
,
1
,
6
,
7
// tid_tag, blk_info
6
,
7
};
SAggFunctionInfo
aAggs
[]
=
{{
...
...
@@ -5400,58 +5316,6 @@ SAggFunctionInfo aAggs[] = {{
},
{
// 31
"sum_rate"
,
TSDB_FUNC_SUM_RATE
,
TSDB_FUNC_SUM_RATE
,
TSDB_BASE_FUNC_SO
|
TSDB_FUNCSTATE_NEED_TS
,
rate_function_setup
,
rate_function
,
rate_function_f
,
sumrate_finalizer
,
sumrate_func_merge
,
dataBlockRequired
,
},
{
// 32
"sum_irate"
,
TSDB_FUNC_SUM_IRATE
,
TSDB_FUNC_SUM_IRATE
,
TSDB_BASE_FUNC_SO
|
TSDB_FUNCSTATE_NEED_TS
,
rate_function_setup
,
irate_function
,
irate_function_f
,
sumrate_finalizer
,
sumrate_func_merge
,
dataBlockRequired
,
},
{
// 33
"avg_rate"
,
TSDB_FUNC_AVG_RATE
,
TSDB_FUNC_AVG_RATE
,
TSDB_BASE_FUNC_SO
|
TSDB_FUNCSTATE_NEED_TS
,
rate_function_setup
,
rate_function
,
rate_function_f
,
sumrate_finalizer
,
sumrate_func_merge
,
dataBlockRequired
,
},
{
// 34
"avg_irate"
,
TSDB_FUNC_AVG_IRATE
,
TSDB_FUNC_AVG_IRATE
,
TSDB_BASE_FUNC_SO
|
TSDB_FUNCSTATE_NEED_TS
,
rate_function_setup
,
irate_function
,
irate_function_f
,
sumrate_finalizer
,
sumrate_func_merge
,
dataBlockRequired
,
},
{
// 35
"tbid"
,
// return table id and the corresponding tags for join match and subscribe
TSDB_FUNC_TID_TAG
,
TSDB_FUNC_TID_TAG
,
...
...
@@ -5464,15 +5328,15 @@ SAggFunctionInfo aAggs[] = {{
dataBlockRequired
,
},
{
// 3
5
"_block_dist"
,
// return table id and the corresponding tags for join match and subscribe
TSDB_FUNC_BLKINFO
,
TSDB_FUNC_BLKINFO
,
TSDB_FUNCSTATE_SO
|
TSDB_FUNCSTATE_STABLE
,
function_setup
,
blockInfo_func
,
noop2
,
blockinfo_func_finalizer
,
block_func_merge
,
dataBlockRequired
,
// 3
2
"_block_dist"
,
// return table id and the corresponding tags for join match and subscribe
TSDB_FUNC_BLKINFO
,
TSDB_FUNC_BLKINFO
,
TSDB_FUNCSTATE_SO
|
TSDB_FUNCSTATE_STABLE
,
function_setup
,
blockInfo_func
,
noop2
,
blockinfo_func_finalizer
,
block_func_merge
,
dataBlockRequired
,
}};
src/query/src/qExecutor.c
浏览文件 @
cdf2d3f4
...
...
@@ -1990,23 +1990,6 @@ void setQueryKilled(SQInfo *pQInfo) { pQInfo->code = TSDB_CODE_TSC_QUERY_CANCELL
// return false;
//}
// TODO REFACTOR:MERGE WITH CLIENT-SIDE FUNCTION
static
UNUSED_FUNC
bool
isSumAvgRateQuery
(
SQueryAttr
*
pQueryAttr
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryAttr
->
numOfOutput
;
++
i
)
{
int32_t
functionId
=
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
;
if
(
functionId
==
TSDB_FUNC_TS
)
{
continue
;
}
if
(
functionId
==
TSDB_FUNC_SUM_RATE
||
functionId
==
TSDB_FUNC_SUM_IRATE
||
functionId
==
TSDB_FUNC_AVG_RATE
||
functionId
==
TSDB_FUNC_AVG_IRATE
)
{
return
true
;
}
}
return
false
;
}
static
bool
isFirstLastRowQuery
(
SQueryAttr
*
pQueryAttr
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryAttr
->
numOfOutput
;
++
i
)
{
int32_t
functionID
=
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录