Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
32a23496
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
32a23496
编写于
10月 25, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
10月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17602 from taosdata/fix/coverity_glzhao
fix: coverity issues
上级
df7cb2e8
600bb6ee
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
104 addition
and
26 deletion
+104
-26
source/common/src/tmsg.c
source/common/src/tmsg.c
+1
-1
source/common/src/ttszip.c
source/common/src/ttszip.c
+3
-1
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+40
-9
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+11
-7
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+1
-1
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+17
-3
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+25
-1
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+1
-1
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+5
-2
未找到文件。
source/common/src/tmsg.c
浏览文件 @
32a23496
...
@@ -5158,7 +5158,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
...
@@ -5158,7 +5158,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
char
name
[
TSDB_COL_NAME_LEN
]
=
{
0
};
char
name
[
TSDB_COL_NAME_LEN
]
=
{
0
};
char
*
tmp
=
NULL
;
char
*
tmp
=
NULL
;
if
(
tDecodeCStr
(
pCoder
,
&
tmp
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
tmp
)
<
0
)
return
-
1
;
str
cpy
(
name
,
tmp
);
str
ncpy
(
name
,
tmp
,
TSDB_COL_NAME_LEN
-
1
);
taosArrayPush
(
pReq
->
ctb
.
tagName
,
name
);
taosArrayPush
(
pReq
->
ctb
.
tagName
,
name
);
}
}
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
...
...
source/common/src/ttszip.c
浏览文件 @
32a23496
...
@@ -187,7 +187,9 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
...
@@ -187,7 +187,9 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
if
(
pTSBuf
->
autoDelete
)
{
if
(
pTSBuf
->
autoDelete
)
{
// ("tsBuf %p destroyed, delete tmp file:%s", pTSBuf, pTSBuf->path);
// ("tsBuf %p destroyed, delete tmp file:%s", pTSBuf, pTSBuf->path);
taosRemoveFile
(
pTSBuf
->
path
);
if
(
taosRemoveFile
(
pTSBuf
->
path
)
!=
0
)
{
// tscError("tsBuf %p destroyed, failed to remove tmp file:%s", pTSBuf, pTSBuf->path);
}
}
else
{
}
else
{
// tscDebug("tsBuf %p destroyed, tmp file:%s, remains", pTSBuf, pTSBuf->path);
// tscDebug("tsBuf %p destroyed, tmp file:%s, remains", pTSBuf, pTSBuf->path);
}
}
...
...
source/libs/function/src/builtins.c
浏览文件 @
32a23496
...
@@ -209,7 +209,7 @@ static int32_t countTrailingSpaces(const SValueNode* pVal, bool isLtrim) {
...
@@ -209,7 +209,7 @@ static int32_t countTrailingSpaces(const SValueNode* pVal, bool isLtrim) {
return
numOfSpaces
;
return
numOfSpaces
;
}
}
void
static
addTimezoneParam
(
SNodeList
*
pList
)
{
static
int32_t
addTimezoneParam
(
SNodeList
*
pList
)
{
char
buf
[
6
]
=
{
0
};
char
buf
[
6
]
=
{
0
};
time_t
t
=
taosTime
(
NULL
);
time_t
t
=
taosTime
(
NULL
);
struct
tm
tmInfo
;
struct
tm
tmInfo
;
...
@@ -218,6 +218,10 @@ void static addTimezoneParam(SNodeList* pList) {
...
@@ -218,6 +218,10 @@ void static addTimezoneParam(SNodeList* pList) {
int32_t
len
=
(
int32_t
)
strlen
(
buf
);
int32_t
len
=
(
int32_t
)
strlen
(
buf
);
SValueNode
*
pVal
=
(
SValueNode
*
)
nodesMakeNode
(
QUERY_NODE_VALUE
);
SValueNode
*
pVal
=
(
SValueNode
*
)
nodesMakeNode
(
QUERY_NODE_VALUE
);
if
(
pVal
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pVal
->
literal
=
strndup
(
buf
,
len
);
pVal
->
literal
=
strndup
(
buf
,
len
);
pVal
->
isDuration
=
false
;
pVal
->
isDuration
=
false
;
pVal
->
translate
=
true
;
pVal
->
translate
=
true
;
...
@@ -229,10 +233,15 @@ void static addTimezoneParam(SNodeList* pList) {
...
@@ -229,10 +233,15 @@ void static addTimezoneParam(SNodeList* pList) {
strncpy
(
varDataVal
(
pVal
->
datum
.
p
),
pVal
->
literal
,
len
);
strncpy
(
varDataVal
(
pVal
->
datum
.
p
),
pVal
->
literal
,
len
);
nodesListAppend
(
pList
,
(
SNode
*
)
pVal
);
nodesListAppend
(
pList
,
(
SNode
*
)
pVal
);
return
TSDB_CODE_SUCCESS
;
}
}
void
static
addDbPrecisonParam
(
SNodeList
**
pList
,
uint8_t
precision
)
{
static
int32_t
addDbPrecisonParam
(
SNodeList
**
pList
,
uint8_t
precision
)
{
SValueNode
*
pVal
=
(
SValueNode
*
)
nodesMakeNode
(
QUERY_NODE_VALUE
);
SValueNode
*
pVal
=
(
SValueNode
*
)
nodesMakeNode
(
QUERY_NODE_VALUE
);
if
(
pVal
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pVal
->
literal
=
NULL
;
pVal
->
literal
=
NULL
;
pVal
->
isDuration
=
false
;
pVal
->
isDuration
=
false
;
pVal
->
translate
=
true
;
pVal
->
translate
=
true
;
...
@@ -244,6 +253,7 @@ void static addDbPrecisonParam(SNodeList** pList, uint8_t precision) {
...
@@ -244,6 +253,7 @@ void static addDbPrecisonParam(SNodeList** pList, uint8_t precision) {
pVal
->
typeData
=
(
int64_t
)
precision
;
pVal
->
typeData
=
(
int64_t
)
precision
;
nodesListMakeAppend
(
pList
,
(
SNode
*
)
pVal
);
nodesListMakeAppend
(
pList
,
(
SNode
*
)
pVal
);
return
TSDB_CODE_SUCCESS
;
}
}
// There is only one parameter of numeric type, and the return type is parameter type
// There is only one parameter of numeric type, and the return type is parameter type
...
@@ -465,7 +475,10 @@ static int32_t translateNowToday(SFunctionNode* pFunc, char* pErrBuf, int32_t le
...
@@ -465,7 +475,10 @@ static int32_t translateNowToday(SFunctionNode* pFunc, char* pErrBuf, int32_t le
// add database precision as param
// add database precision as param
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
sizeof
(
int64_t
),
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
};
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
sizeof
(
int64_t
),
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
};
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -1487,7 +1500,10 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
...
@@ -1487,7 +1500,10 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
// add database precision as param
// add database precision as param
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
,
.
type
=
TSDB_DATA_TYPE_DOUBLE
};
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
,
.
type
=
TSDB_DATA_TYPE_DOUBLE
};
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -1810,7 +1826,10 @@ static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
...
@@ -1810,7 +1826,10 @@ static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
// add database precision as param
// add database precision as param
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1844,7 +1863,10 @@ static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t l
...
@@ -1844,7 +1863,10 @@ static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t l
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"Invalid timzone format"
);
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"Invalid timzone format"
);
}
}
}
else
{
// add default client timezone
}
else
{
// add default client timezone
addTimezoneParam
(
pFunc
->
pParameterList
);
int32_t
code
=
addTimezoneParam
(
pFunc
->
pParameterList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
}
}
// set result type
// set result type
...
@@ -1863,7 +1885,10 @@ static int32_t translateToUnixtimestamp(SFunctionNode* pFunc, char* pErrBuf, int
...
@@ -1863,7 +1885,10 @@ static int32_t translateToUnixtimestamp(SFunctionNode* pFunc, char* pErrBuf, int
// add database precision as param
// add database precision as param
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_BIGINT
].
bytes
,
.
type
=
TSDB_DATA_TYPE_BIGINT
};
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_BIGINT
].
bytes
,
.
type
=
TSDB_DATA_TYPE_BIGINT
};
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -1894,7 +1919,10 @@ static int32_t translateTimeTruncate(SFunctionNode* pFunc, char* pErrBuf, int32_
...
@@ -1894,7 +1919,10 @@ static int32_t translateTimeTruncate(SFunctionNode* pFunc, char* pErrBuf, int32_
"TIMETRUNCATE function time unit parameter should be one of the following: [1b, 1u, 1a, 1s, 1m, 1h, 1d, 1w]"
);
"TIMETRUNCATE function time unit parameter should be one of the following: [1b, 1u, 1a, 1s, 1m, 1h, 1d, 1w]"
);
}
}
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
pFunc
->
node
.
resType
=
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_TIMESTAMP
].
bytes
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
};
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_TIMESTAMP
].
bytes
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
};
...
@@ -1935,7 +1963,10 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le
...
@@ -1935,7 +1963,10 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le
}
}
}
}
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_BIGINT
].
bytes
,
.
type
=
TSDB_DATA_TYPE_BIGINT
};
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_BIGINT
].
bytes
,
.
type
=
TSDB_DATA_TYPE_BIGINT
};
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
32a23496
...
@@ -1861,7 +1861,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
...
@@ -1861,7 +1861,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
numOfElem
+=
1
;
numOfElem
+=
1
;
pStddevRes
->
count
+=
1
;
pStddevRes
->
count
+=
1
;
pStddevRes
->
usum
+=
plist
[
i
];
pStddevRes
->
usum
+=
plist
[
i
];
pStddevRes
->
quadratic
I
Sum
+=
plist
[
i
]
*
plist
[
i
];
pStddevRes
->
quadratic
U
Sum
+=
plist
[
i
]
*
plist
[
i
];
}
}
break
;
break
;
...
@@ -1877,7 +1877,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
...
@@ -1877,7 +1877,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
numOfElem
+=
1
;
numOfElem
+=
1
;
pStddevRes
->
count
+=
1
;
pStddevRes
->
count
+=
1
;
pStddevRes
->
usum
+=
plist
[
i
];
pStddevRes
->
usum
+=
plist
[
i
];
pStddevRes
->
quadratic
I
Sum
+=
plist
[
i
]
*
plist
[
i
];
pStddevRes
->
quadratic
U
Sum
+=
plist
[
i
]
*
plist
[
i
];
}
}
break
;
break
;
}
}
...
@@ -1892,7 +1892,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
...
@@ -1892,7 +1892,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
numOfElem
+=
1
;
numOfElem
+=
1
;
pStddevRes
->
count
+=
1
;
pStddevRes
->
count
+=
1
;
pStddevRes
->
usum
+=
plist
[
i
];
pStddevRes
->
usum
+=
plist
[
i
];
pStddevRes
->
quadratic
I
Sum
+=
plist
[
i
]
*
plist
[
i
];
pStddevRes
->
quadratic
U
Sum
+=
plist
[
i
]
*
plist
[
i
];
}
}
break
;
break
;
...
@@ -1908,7 +1908,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
...
@@ -1908,7 +1908,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) {
numOfElem
+=
1
;
numOfElem
+=
1
;
pStddevRes
->
count
+=
1
;
pStddevRes
->
count
+=
1
;
pStddevRes
->
usum
+=
plist
[
i
];
pStddevRes
->
usum
+=
plist
[
i
];
pStddevRes
->
quadratic
I
Sum
+=
plist
[
i
]
*
plist
[
i
];
pStddevRes
->
quadratic
U
Sum
+=
plist
[
i
]
*
plist
[
i
];
}
}
break
;
break
;
}
}
...
@@ -5359,7 +5359,7 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -5359,7 +5359,7 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SColumnInfoData
*
pCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
SColumnInfoData
*
pCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
int32_t
currentRow
=
pBlock
->
info
.
rows
;
int32_t
currentRow
=
pBlock
->
info
.
rows
;
int32_t
resIndex
;
int32_t
resIndex
=
-
1
;
int32_t
maxCount
=
0
;
int32_t
maxCount
=
0
;
for
(
int32_t
i
=
0
;
i
<
pInfo
->
numOfPoints
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pInfo
->
numOfPoints
;
++
i
)
{
SModeItem
*
pItem
=
(
SModeItem
*
)(
pInfo
->
pItems
+
i
*
(
sizeof
(
SModeItem
)
+
pInfo
->
colBytes
));
SModeItem
*
pItem
=
(
SModeItem
*
)(
pInfo
->
pItems
+
i
*
(
sizeof
(
SModeItem
)
+
pInfo
->
colBytes
));
...
@@ -5369,8 +5369,12 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -5369,8 +5369,12 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
}
}
}
}
SModeItem
*
pResItem
=
(
SModeItem
*
)(
pInfo
->
pItems
+
resIndex
*
(
sizeof
(
SModeItem
)
+
pInfo
->
colBytes
));
if
(
maxCount
!=
0
)
{
colDataAppend
(
pCol
,
currentRow
,
pResItem
->
data
,
(
maxCount
==
0
)
?
true
:
false
);
SModeItem
*
pResItem
=
(
SModeItem
*
)(
pInfo
->
pItems
+
resIndex
*
(
sizeof
(
SModeItem
)
+
pInfo
->
colBytes
));
colDataAppend
(
pCol
,
currentRow
,
pResItem
->
data
,
false
);
}
else
{
colDataAppendNULL
(
pCol
,
currentRow
);
}
return
pResInfo
->
numOfRes
;
return
pResInfo
->
numOfRes
;
}
}
...
...
source/libs/function/src/tpercentile.c
浏览文件 @
32a23496
...
@@ -495,7 +495,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
...
@@ -495,7 +495,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
int32_t
groupId
=
getGroupId
(
pMemBucket
->
numOfSlots
,
i
,
pMemBucket
->
times
-
1
);
int32_t
groupId
=
getGroupId
(
pMemBucket
->
numOfSlots
,
i
,
pMemBucket
->
times
-
1
);
SIDList
list
=
taosHashGet
(
pMemBucket
->
groupPagesMap
,
&
groupId
,
sizeof
(
groupId
));
SIDList
list
=
taosHashGet
(
pMemBucket
->
groupPagesMap
,
&
groupId
,
sizeof
(
groupId
));
assert
(
list
->
size
>
0
);
ASSERT
(
list
!=
NULL
&&
list
->
size
>
0
);
for
(
int32_t
f
=
0
;
f
<
list
->
size
;
++
f
)
{
for
(
int32_t
f
=
0
;
f
<
list
->
size
;
++
f
)
{
SPageInfo
*
pgInfo
=
*
(
SPageInfo
**
)
taosArrayGet
(
list
,
f
);
SPageInfo
*
pgInfo
=
*
(
SPageInfo
**
)
taosArrayGet
(
list
,
f
);
...
...
source/libs/scalar/src/filter.c
浏览文件 @
32a23496
...
@@ -1082,7 +1082,12 @@ int32_t filterAddUnitImpl(SFilterInfo *info, uint8_t optr, SFilterFieldId *left,
...
@@ -1082,7 +1082,12 @@ int32_t filterAddUnitImpl(SFilterInfo *info, uint8_t optr, SFilterFieldId *left,
if
(
info
->
unitNum
>=
info
->
unitSize
)
{
if
(
info
->
unitNum
>=
info
->
unitSize
)
{
uint32_t
psize
=
info
->
unitSize
;
uint32_t
psize
=
info
->
unitSize
;
info
->
unitSize
+=
FILTER_DEFAULT_UNIT_SIZE
;
info
->
unitSize
+=
FILTER_DEFAULT_UNIT_SIZE
;
info
->
units
=
taosMemoryRealloc
(
info
->
units
,
info
->
unitSize
*
sizeof
(
SFilterUnit
));
void
*
tmp
=
taosMemoryRealloc
(
info
->
units
,
info
->
unitSize
*
sizeof
(
SFilterUnit
));
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
info
->
units
=
tmp
;
memset
(
info
->
units
+
psize
,
0
,
sizeof
(
*
info
->
units
)
*
FILTER_DEFAULT_UNIT_SIZE
);
memset
(
info
->
units
+
psize
,
0
,
sizeof
(
*
info
->
units
)
*
FILTER_DEFAULT_UNIT_SIZE
);
}
}
...
@@ -1135,7 +1140,12 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi
...
@@ -1135,7 +1140,12 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi
int32_t
filterAddUnitToGroup
(
SFilterGroup
*
group
,
uint32_t
unitIdx
)
{
int32_t
filterAddUnitToGroup
(
SFilterGroup
*
group
,
uint32_t
unitIdx
)
{
if
(
group
->
unitNum
>=
group
->
unitSize
)
{
if
(
group
->
unitNum
>=
group
->
unitSize
)
{
group
->
unitSize
+=
FILTER_DEFAULT_UNIT_SIZE
;
group
->
unitSize
+=
FILTER_DEFAULT_UNIT_SIZE
;
group
->
unitIdxs
=
taosMemoryRealloc
(
group
->
unitIdxs
,
group
->
unitSize
*
sizeof
(
*
group
->
unitIdxs
));
void
*
tmp
=
taosMemoryRealloc
(
group
->
unitIdxs
,
group
->
unitSize
*
sizeof
(
*
group
->
unitIdxs
));
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
group
->
unitIdxs
=
tmp
;
}
}
group
->
unitIdxs
[
group
->
unitNum
++
]
=
unitIdx
;
group
->
unitIdxs
[
group
->
unitNum
++
]
=
unitIdx
;
...
@@ -3712,7 +3722,7 @@ EDealRes fltReviseRewriter(SNode **pNode, void *pContext) {
...
@@ -3712,7 +3722,7 @@ EDealRes fltReviseRewriter(SNode **pNode, void *pContext) {
SListCell
*
cell
=
node
->
pParameterList
->
pHead
;
SListCell
*
cell
=
node
->
pParameterList
->
pHead
;
for
(
int32_t
i
=
0
;
i
<
node
->
pParameterList
->
length
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
node
->
pParameterList
->
length
;
++
i
)
{
if
(
NULL
==
cell
||
NULL
==
cell
->
pNode
)
{
if
(
NULL
==
cell
||
NULL
==
cell
->
pNode
)
{
fltError
(
"invalid cell
, cell:%p, pNode:%p"
,
cell
,
cell
->
pNode
);
fltError
(
"invalid cell
"
);
stat
->
code
=
TSDB_CODE_QRY_INVALID_INPUT
;
stat
->
code
=
TSDB_CODE_QRY_INVALID_INPUT
;
return
DEAL_RES_ERROR
;
return
DEAL_RES_ERROR
;
}
}
...
@@ -4066,6 +4076,10 @@ bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, SC
...
@@ -4066,6 +4076,10 @@ bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, SC
*
p
=
output
.
columnData
;
*
p
=
output
.
columnData
;
output
.
numOfRows
=
pSrc
->
info
.
rows
;
output
.
numOfRows
=
pSrc
->
info
.
rows
;
if
(
*
p
==
NULL
)
{
return
false
;
}
bool
keep
=
(
*
info
->
func
)(
info
,
pSrc
->
info
.
rows
,
*
p
,
statis
,
numOfCols
,
&
output
.
numOfQualified
);
bool
keep
=
(
*
info
->
func
)(
info
,
pSrc
->
info
.
rows
,
*
p
,
statis
,
numOfCols
,
&
output
.
numOfQualified
);
// todo this should be return during filter procedure
// todo this should be return during filter procedure
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
32a23496
...
@@ -331,7 +331,10 @@ int32_t sclInitParam(SNode *node, SScalarParam *param, SScalarCtx *ctx, int32_t
...
@@ -331,7 +331,10 @@ int32_t sclInitParam(SNode *node, SScalarParam *param, SScalarCtx *ctx, int32_t
ASSERT
(
param
->
columnData
==
NULL
);
ASSERT
(
param
->
columnData
==
NULL
);
param
->
numOfRows
=
1
;
param
->
numOfRows
=
1
;
/*int32_t code = */
sclCreateColumnInfoData
(
&
valueNode
->
node
.
resType
,
1
,
param
);
int32_t
code
=
sclCreateColumnInfoData
(
&
valueNode
->
node
.
resType
,
1
,
param
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
SCL_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
if
(
TSDB_DATA_TYPE_NULL
==
valueNode
->
node
.
resType
.
type
||
valueNode
->
isNull
)
{
if
(
TSDB_DATA_TYPE_NULL
==
valueNode
->
node
.
resType
.
type
||
valueNode
->
isNull
)
{
colDataAppendNULL
(
param
->
columnData
,
0
);
colDataAppendNULL
(
param
->
columnData
,
0
);
}
else
{
}
else
{
...
@@ -1485,8 +1488,13 @@ static int32_t sclGetMinusOperatorResType(SOperatorNode *pOp) {
...
@@ -1485,8 +1488,13 @@ static int32_t sclGetMinusOperatorResType(SOperatorNode *pOp) {
}
}
static
int32_t
sclGetMathOperatorResType
(
SOperatorNode
*
pOp
)
{
static
int32_t
sclGetMathOperatorResType
(
SOperatorNode
*
pOp
)
{
if
(
pOp
==
NULL
||
pOp
->
pLeft
==
NULL
||
pOp
->
pRight
==
NULL
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
if
((
TSDB_DATA_TYPE_TIMESTAMP
==
ldt
.
type
&&
TSDB_DATA_TYPE_TIMESTAMP
==
rdt
.
type
)
||
if
((
TSDB_DATA_TYPE_TIMESTAMP
==
ldt
.
type
&&
TSDB_DATA_TYPE_TIMESTAMP
==
rdt
.
type
)
||
(
TSDB_DATA_TYPE_TIMESTAMP
==
ldt
.
type
&&
(
IS_VAR_DATA_TYPE
(
rdt
.
type
)
||
IS_FLOAT_TYPE
(
rdt
.
type
)))
||
(
TSDB_DATA_TYPE_TIMESTAMP
==
ldt
.
type
&&
(
IS_VAR_DATA_TYPE
(
rdt
.
type
)
||
IS_FLOAT_TYPE
(
rdt
.
type
)))
||
(
TSDB_DATA_TYPE_TIMESTAMP
==
rdt
.
type
&&
(
IS_VAR_DATA_TYPE
(
ldt
.
type
)
||
IS_FLOAT_TYPE
(
ldt
.
type
))))
{
(
TSDB_DATA_TYPE_TIMESTAMP
==
rdt
.
type
&&
(
IS_VAR_DATA_TYPE
(
ldt
.
type
)
||
IS_FLOAT_TYPE
(
ldt
.
type
))))
{
...
@@ -1507,10 +1515,21 @@ static int32_t sclGetMathOperatorResType(SOperatorNode *pOp) {
...
@@ -1507,10 +1515,21 @@ static int32_t sclGetMathOperatorResType(SOperatorNode *pOp) {
}
}
static
int32_t
sclGetCompOperatorResType
(
SOperatorNode
*
pOp
)
{
static
int32_t
sclGetCompOperatorResType
(
SOperatorNode
*
pOp
)
{
if
(
pOp
==
NULL
||
pOp
->
pLeft
==
NULL
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
if
(
OP_TYPE_IN
==
pOp
->
opType
||
OP_TYPE_NOT_IN
==
pOp
->
opType
)
{
if
(
OP_TYPE_IN
==
pOp
->
opType
||
OP_TYPE_NOT_IN
==
pOp
->
opType
)
{
if
(
pOp
->
pRight
==
NULL
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
=
ldt
;
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
=
ldt
;
}
else
if
(
nodesIsRegularOp
(
pOp
))
{
}
else
if
(
nodesIsRegularOp
(
pOp
))
{
if
(
pOp
->
pRight
==
NULL
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
if
(
!
IS_VAR_DATA_TYPE
(
ldt
.
type
)
||
QUERY_NODE_VALUE
!=
nodeType
(
pOp
->
pRight
)
||
if
(
!
IS_VAR_DATA_TYPE
(
ldt
.
type
)
||
QUERY_NODE_VALUE
!=
nodeType
(
pOp
->
pRight
)
||
(
!
IS_STR_DATA_TYPE
(
rdt
.
type
)
&&
(
rdt
.
type
!=
TSDB_DATA_TYPE_NULL
)))
{
(
!
IS_STR_DATA_TYPE
(
rdt
.
type
)
&&
(
rdt
.
type
!=
TSDB_DATA_TYPE_NULL
)))
{
...
@@ -1523,8 +1542,13 @@ static int32_t sclGetCompOperatorResType(SOperatorNode *pOp) {
...
@@ -1523,8 +1542,13 @@ static int32_t sclGetCompOperatorResType(SOperatorNode *pOp) {
}
}
static
int32_t
sclGetJsonOperatorResType
(
SOperatorNode
*
pOp
)
{
static
int32_t
sclGetJsonOperatorResType
(
SOperatorNode
*
pOp
)
{
if
(
pOp
==
NULL
||
pOp
->
pLeft
==
NULL
||
pOp
->
pRight
==
NULL
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
if
(
TSDB_DATA_TYPE_JSON
!=
ldt
.
type
||
!
IS_STR_DATA_TYPE
(
rdt
.
type
))
{
if
(
TSDB_DATA_TYPE_JSON
!=
ldt
.
type
||
!
IS_STR_DATA_TYPE
(
rdt
.
type
))
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
32a23496
...
@@ -1416,7 +1416,7 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
...
@@ -1416,7 +1416,7 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
}
else
if
(
tsDigits
==
TSDB_TIME_PRECISION_MICRO_DIGITS
)
{
}
else
if
(
tsDigits
==
TSDB_TIME_PRECISION_MICRO_DIGITS
)
{
timeVal
[
k
]
=
timeVal
[
k
]
*
1000
;
timeVal
[
k
]
=
timeVal
[
k
]
*
1000
;
}
else
if
(
tsDigits
==
TSDB_TIME_PRECISION_NANO_DIGITS
)
{
}
else
if
(
tsDigits
==
TSDB_TIME_PRECISION_NANO_DIGITS
)
{
timeVal
[
k
]
=
timeVal
[
k
];
timeVal
[
k
]
=
timeVal
[
k
]
*
1
;
}
else
{
}
else
{
hasNull
=
true
;
hasNull
=
true
;
break
;
break
;
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
32a23496
...
@@ -344,8 +344,11 @@ static FORCE_INLINE void varToNchar(char *buf, SScalarParam *pOut, int32_t rowIn
...
@@ -344,8 +344,11 @@ static FORCE_INLINE void varToNchar(char *buf, SScalarParam *pOut, int32_t rowIn
int32_t
outputMaxLen
=
(
inputLen
+
1
)
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
;
int32_t
outputMaxLen
=
(
inputLen
+
1
)
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
;
char
*
t
=
taosMemoryCalloc
(
1
,
outputMaxLen
);
char
*
t
=
taosMemoryCalloc
(
1
,
outputMaxLen
);
/*int32_t resLen = */
taosMbsToUcs4
(
varDataVal
(
buf
),
inputLen
,
(
TdUcs4
*
)
varDataVal
(
t
),
int32_t
ret
=
taosMbsToUcs4
(
varDataVal
(
buf
),
inputLen
,
(
TdUcs4
*
)
varDataVal
(
t
),
outputMaxLen
-
VARSTR_HEADER_SIZE
,
&
len
);
outputMaxLen
-
VARSTR_HEADER_SIZE
,
&
len
);
if
(
!
ret
)
{
sclError
(
"failed to convert to NCHAR"
);
}
varDataSetLen
(
t
,
len
);
varDataSetLen
(
t
,
len
);
colDataAppend
(
pOut
->
columnData
,
rowIndex
,
t
,
false
);
colDataAppend
(
pOut
->
columnData
,
rowIndex
,
t
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录