Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f080f321
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
提交
f080f321
编写于
6月 13, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
merge 3.0
上级
8ed69d21
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
9 addition
and
70 deletion
+9
-70
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+0
-3
source/libs/function/inc/builtins.h
source/libs/function/inc/builtins.h
+0
-2
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+0
-44
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+0
-9
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+9
-12
未找到文件。
include/libs/function/functionMgt.h
浏览文件 @
f080f321
...
@@ -177,9 +177,6 @@ bool fmIsDistExecFunc(int32_t funcId);
...
@@ -177,9 +177,6 @@ bool fmIsDistExecFunc(int32_t funcId);
bool
fmIsForbidFillFunc
(
int32_t
funcId
);
bool
fmIsForbidFillFunc
(
int32_t
funcId
);
bool
fmIsForbidStreamFunc
(
int32_t
funcId
);
bool
fmIsForbidStreamFunc
(
int32_t
funcId
);
bool
fmNeedRewrite
(
int32_t
funcId
);
int32_t
fmRewriteFunc
(
SNode
**
pFunc
);
int32_t
fmGetDistMethod
(
const
SFunctionNode
*
pFunc
,
SFunctionNode
**
pPartialFunc
,
SFunctionNode
**
pMergeFunc
);
int32_t
fmGetDistMethod
(
const
SFunctionNode
*
pFunc
,
SFunctionNode
**
pPartialFunc
,
SFunctionNode
**
pMergeFunc
);
typedef
enum
EFuncDataRequired
{
typedef
enum
EFuncDataRequired
{
...
...
source/libs/function/inc/builtins.h
浏览文件 @
f080f321
...
@@ -23,7 +23,6 @@ extern "C" {
...
@@ -23,7 +23,6 @@ extern "C" {
#include "functionMgtInt.h"
#include "functionMgtInt.h"
typedef
int32_t
(
*
FTranslateFunc
)(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
);
typedef
int32_t
(
*
FTranslateFunc
)(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
);
typedef
int32_t
(
*
FRewriteFunc
)(
SNode
**
pFunc
);
typedef
EFuncDataRequired
(
*
FFuncDataRequired
)(
SFunctionNode
*
pFunc
,
STimeWindow
*
pTimeWindow
);
typedef
EFuncDataRequired
(
*
FFuncDataRequired
)(
SFunctionNode
*
pFunc
,
STimeWindow
*
pTimeWindow
);
typedef
struct
SBuiltinFuncDefinition
{
typedef
struct
SBuiltinFuncDefinition
{
...
@@ -31,7 +30,6 @@ typedef struct SBuiltinFuncDefinition {
...
@@ -31,7 +30,6 @@ typedef struct SBuiltinFuncDefinition {
EFunctionType
type
;
EFunctionType
type
;
uint64_t
classification
;
uint64_t
classification
;
FTranslateFunc
translateFunc
;
FTranslateFunc
translateFunc
;
FRewriteFunc
rewriteFunc
;
FFuncDataRequired
dataRequiredFunc
;
FFuncDataRequired
dataRequiredFunc
;
FExecGetEnv
getEnvFunc
;
FExecGetEnv
getEnvFunc
;
FExecInit
initFunc
;
FExecInit
initFunc
;
...
...
source/libs/function/src/builtins.c
浏览文件 @
f080f321
...
@@ -1387,49 +1387,6 @@ static bool getBlockDistFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv
...
@@ -1387,49 +1387,6 @@ static bool getBlockDistFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv
return
true
;
return
true
;
}
}
static
int32_t
rewriteAvg
(
SNode
**
pFunc
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
nodesMakeNode
(
QUERY_NODE_OPERATOR
);
if
(
NULL
==
pOper
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SFunctionNode
*
pAvg
=
(
SFunctionNode
*
)
*
pFunc
;
pOper
->
node
.
resType
=
pAvg
->
node
.
resType
;
strcpy
(
pOper
->
node
.
aliasName
,
pAvg
->
node
.
aliasName
);
pOper
->
opType
=
OP_TYPE_DIV
;
pOper
->
pLeft
=
nodesMakeNode
(
QUERY_NODE_FUNCTION
);
pOper
->
pRight
=
nodesMakeNode
(
QUERY_NODE_FUNCTION
);
if
(
NULL
==
pOper
->
pLeft
||
NULL
==
pOper
->
pRight
)
{
nodesDestroyNode
((
SNode
*
)
pOper
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SFunctionNode
*
pSum
=
(
SFunctionNode
*
)
pOper
->
pLeft
;
strcpy
(
pSum
->
functionName
,
"sum"
);
pSum
->
pParameterList
=
nodesCloneList
(
pAvg
->
pParameterList
);
if
(
NULL
==
pSum
->
pParameterList
)
{
nodesDestroyNode
((
SNode
*
)
pOper
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
char
msgBuf
[
64
]
=
{
0
};
int32_t
code
=
fmGetFuncInfo
(
pSum
,
msgBuf
,
sizeof
(
msgBuf
));
if
(
TSDB_CODE_SUCCESS
==
code
)
{
SFunctionNode
*
pCount
=
(
SFunctionNode
*
)
pOper
->
pRight
;
strcpy
(
pCount
->
functionName
,
"count"
);
TSWAP
(
pCount
->
pParameterList
,
pAvg
->
pParameterList
);
code
=
fmGetFuncInfo
(
pCount
,
msgBuf
,
sizeof
(
msgBuf
));
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
nodesDestroyNode
((
SNode
*
)
pAvg
);
*
pFunc
=
(
SNode
*
)
pOper
;
}
else
{
nodesDestroyNode
((
SNode
*
)
pOper
);
}
return
code
;
}
// clang-format off
// clang-format off
const
SBuiltinFuncDefinition
funcMgtBuiltins
[]
=
{
const
SBuiltinFuncDefinition
funcMgtBuiltins
[]
=
{
{
{
...
@@ -1519,7 +1476,6 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1519,7 +1476,6 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
type
=
FUNCTION_TYPE_AVG
,
.
type
=
FUNCTION_TYPE_AVG
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
translateFunc
=
translateInNumOutDou
,
.
translateFunc
=
translateInNumOutDou
,
// .rewriteFunc = rewriteAvg,
.
getEnvFunc
=
getAvgFuncEnv
,
.
getEnvFunc
=
getAvgFuncEnv
,
.
initFunc
=
avgFunctionSetup
,
.
initFunc
=
avgFunctionSetup
,
.
processFunc
=
avgFunction
,
.
processFunc
=
avgFunction
,
...
...
source/libs/function/src/functionMgt.c
浏览文件 @
f080f321
...
@@ -324,12 +324,3 @@ int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc
...
@@ -324,12 +324,3 @@ int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc
return
code
;
return
code
;
}
}
bool
fmNeedRewrite
(
int32_t
funcId
)
{
if
(
fmIsUserDefinedFunc
(
funcId
))
{
return
false
;
}
return
NULL
!=
funcMgtBuiltins
[
funcId
].
rewriteFunc
;
}
int32_t
fmRewriteFunc
(
SNode
**
pFunc
)
{
return
funcMgtBuiltins
[((
SFunctionNode
*
)
*
pFunc
)
->
funcId
].
rewriteFunc
(
pFunc
);
}
source/libs/parser/src/parTranslater.c
浏览文件 @
f080f321
...
@@ -1076,32 +1076,29 @@ static void setFuncClassification(SSelectStmt* pSelect, SFunctionNode* pFunc) {
...
@@ -1076,32 +1076,29 @@ static void setFuncClassification(SSelectStmt* pSelect, SFunctionNode* pFunc) {
}
}
}
}
static
EDealRes
translateFunction
(
STranslateContext
*
pCxt
,
SFunctionNode
*
*
pFunc
)
{
static
EDealRes
translateFunction
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
SNode
*
pParam
=
NULL
;
SNode
*
pParam
=
NULL
;
FOREACH
(
pParam
,
(
*
pFunc
)
->
pParameterList
)
{
FOREACH
(
pParam
,
pFunc
->
pParameterList
)
{
if
(
isMultiResFunc
(
pParam
))
{
if
(
isMultiResFunc
(
pParam
))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)
pParam
)
->
aliasName
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)
pParam
)
->
aliasName
);
}
}
}
}
pCxt
->
errCode
=
getFuncInfo
(
pCxt
,
*
pFunc
);
pCxt
->
errCode
=
getFuncInfo
(
pCxt
,
pFunc
);
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
pCxt
->
errCode
=
translateAggFunc
(
pCxt
,
*
pFunc
);
pCxt
->
errCode
=
translateAggFunc
(
pCxt
,
pFunc
);
}
}
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
pCxt
->
errCode
=
translateScanPseudoColumnFunc
(
pCxt
,
*
pFunc
);
pCxt
->
errCode
=
translateScanPseudoColumnFunc
(
pCxt
,
pFunc
);
}
}
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
pCxt
->
errCode
=
translateIndefiniteRowsFunc
(
pCxt
,
*
pFunc
);
pCxt
->
errCode
=
translateIndefiniteRowsFunc
(
pCxt
,
pFunc
);
}
}
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
pCxt
->
errCode
=
translateForbidFillFunc
(
pCxt
,
*
pFunc
);
pCxt
->
errCode
=
translateForbidFillFunc
(
pCxt
,
pFunc
);
}
}
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
setFuncClassification
(
pCxt
->
pCurrSelectStmt
,
*
pFunc
);
setFuncClassification
(
pCxt
->
pCurrSelectStmt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
&&
fmNeedRewrite
((
*
pFunc
)
->
funcId
))
{
pCxt
->
errCode
=
fmRewriteFunc
((
SNode
**
)
pFunc
);
}
}
return
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
?
DEAL_RES_CONTINUE
:
DEAL_RES_ERROR
;
return
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
?
DEAL_RES_CONTINUE
:
DEAL_RES_ERROR
;
}
}
...
@@ -1126,7 +1123,7 @@ static EDealRes doTranslateExpr(SNode** pNode, void* pContext) {
...
@@ -1126,7 +1123,7 @@ static EDealRes doTranslateExpr(SNode** pNode, void* pContext) {
case
QUERY_NODE_OPERATOR
:
case
QUERY_NODE_OPERATOR
:
return
translateOperator
(
pCxt
,
(
SOperatorNode
**
)
pNode
);
return
translateOperator
(
pCxt
,
(
SOperatorNode
**
)
pNode
);
case
QUERY_NODE_FUNCTION
:
case
QUERY_NODE_FUNCTION
:
return
translateFunction
(
pCxt
,
(
SFunctionNode
*
*
)
pNode
);
return
translateFunction
(
pCxt
,
(
SFunctionNode
*
)
pNode
);
case
QUERY_NODE_LOGIC_CONDITION
:
case
QUERY_NODE_LOGIC_CONDITION
:
return
translateLogicCond
(
pCxt
,
(
SLogicConditionNode
*
)
*
pNode
);
return
translateLogicCond
(
pCxt
,
(
SLogicConditionNode
*
)
*
pNode
);
case
QUERY_NODE_TEMP_TABLE
:
case
QUERY_NODE_TEMP_TABLE
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录