Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
38c61a1a
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
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看板
提交
38c61a1a
编写于
6月 23, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: pow/log function invalid input handling
上级
9399f5fd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
6 deletion
+11
-6
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+4
-3
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+7
-3
未找到文件。
source/libs/function/src/builtins.c
浏览文件 @
38c61a1a
...
@@ -79,7 +79,8 @@ static int32_t translateIn2NumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_
...
@@ -79,7 +79,8 @@ static int32_t translateIn2NumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_
uint8_t
para1Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
uint8_t
para1Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
uint8_t
para2Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
uint8_t
para2Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
if
(
!
IS_NUMERIC_TYPE
(
para1Type
)
||
!
IS_NUMERIC_TYPE
(
para2Type
))
{
if
((
!
IS_NUMERIC_TYPE
(
para1Type
)
&&
!
IS_NULL_TYPE
(
para1Type
))
||
(
!
IS_NUMERIC_TYPE
(
para2Type
)
&&
!
IS_NULL_TYPE
(
para2Type
)))
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
...
@@ -109,13 +110,13 @@ static int32_t translateLogarithm(SFunctionNode* pFunc, char* pErrBuf, int32_t l
...
@@ -109,13 +110,13 @@ static int32_t translateLogarithm(SFunctionNode* pFunc, char* pErrBuf, int32_t l
}
}
uint8_t
para1Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
uint8_t
para1Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
if
(
!
IS_NUMERIC_TYPE
(
para1Type
))
{
if
(
!
IS_NUMERIC_TYPE
(
para1Type
)
&&
!
IS_NULL_TYPE
(
para1Type
)
)
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
if
(
2
==
numOfParams
)
{
if
(
2
==
numOfParams
)
{
uint8_t
para2Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
uint8_t
para2Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
if
(
!
IS_NUMERIC_TYPE
(
para2Type
))
{
if
(
!
IS_NUMERIC_TYPE
(
para2Type
)
&&
!
IS_NULL_TYPE
(
para2Type
)
)
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
}
}
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
38c61a1a
...
@@ -172,11 +172,15 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
...
@@ -172,11 +172,15 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
double
*
out
=
(
double
*
)
pOutputData
->
pData
;
double
*
out
=
(
double
*
)
pOutputData
->
pData
;
double
result
;
double
result
;
bool
hasNullType
=
(
IS_NULL_TYPE
(
GET_PARAM_TYPE
(
&
pInput
[
0
]))
||
IS_NULL_TYPE
(
GET_PARAM_TYPE
(
&
pInput
[
1
])));
int32_t
numOfRows
=
TMAX
(
pInput
[
0
].
numOfRows
,
pInput
[
1
].
numOfRows
);
int32_t
numOfRows
=
TMAX
(
pInput
[
0
].
numOfRows
,
pInput
[
1
].
numOfRows
);
if
(
pInput
[
0
].
numOfRows
==
pInput
[
1
].
numOfRows
)
{
if
(
pInput
[
0
].
numOfRows
==
pInput
[
1
].
numOfRows
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
if
(
colDataIsNull_s
(
pInputData
[
0
],
i
)
||
if
(
colDataIsNull_s
(
pInputData
[
0
],
i
)
||
colDataIsNull_s
(
pInputData
[
1
],
i
))
{
colDataIsNull_s
(
pInputData
[
1
],
i
)
||
hasNullType
)
{
colDataAppendNULL
(
pOutputData
,
i
);
colDataAppendNULL
(
pOutputData
,
i
);
continue
;
continue
;
}
}
...
@@ -188,7 +192,7 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
...
@@ -188,7 +192,7 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
}
}
}
}
}
else
if
(
pInput
[
0
].
numOfRows
==
1
)
{
//left operand is constant
}
else
if
(
pInput
[
0
].
numOfRows
==
1
)
{
//left operand is constant
if
(
colDataIsNull_s
(
pInputData
[
0
],
0
))
{
if
(
colDataIsNull_s
(
pInputData
[
0
],
0
)
||
hasNullType
)
{
colDataAppendNNULL
(
pOutputData
,
0
,
pInput
[
1
].
numOfRows
);
colDataAppendNNULL
(
pOutputData
,
0
,
pInput
[
1
].
numOfRows
);
}
else
{
}
else
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
...
@@ -207,7 +211,7 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
...
@@ -207,7 +211,7 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
}
}
}
}
}
else
if
(
pInput
[
1
].
numOfRows
==
1
)
{
}
else
if
(
pInput
[
1
].
numOfRows
==
1
)
{
if
(
colDataIsNull_s
(
pInputData
[
1
],
0
))
{
if
(
colDataIsNull_s
(
pInputData
[
1
],
0
)
||
hasNullType
)
{
colDataAppendNNULL
(
pOutputData
,
0
,
pInput
[
0
].
numOfRows
);
colDataAppendNNULL
(
pOutputData
,
0
,
pInput
[
0
].
numOfRows
);
}
else
{
}
else
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录