Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
72f6b934
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看板
未验证
提交
72f6b934
编写于
11月 14, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
11月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18108 from taosdata/fix/TD-20366
fix: runtime error (division by zero in builtinsimpl.c)
上级
14a1f4e3
52c222dd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
60 addition
and
53 deletion
+60
-53
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+59
-52
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-1
未找到文件。
source/libs/function/src/builtinsimpl.c
浏览文件 @
72f6b934
...
...
@@ -269,7 +269,7 @@ typedef struct SModeInfo {
STuplePos
nullTuplePos
;
bool
nullTupleSaved
;
char
pItems
[];
char
pItems
[];
}
SModeInfo
;
typedef
struct
SDerivInfo
{
...
...
@@ -911,7 +911,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) {
case
TSDB_DATA_TYPE_FLOAT
:
{
float
*
plist
=
(
float
*
)
pCol
->
pData
;
// float val = 0;
// float val = 0;
for
(
int32_t
i
=
start
;
i
<
numOfRows
+
pInput
->
startRowIndex
;
++
i
)
{
if
(
pCol
->
hasNull
&&
colDataIsNull_f
(
pCol
->
nullbitmap
,
i
))
{
continue
;
...
...
@@ -919,9 +919,9 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) {
numOfElem
+=
1
;
pAvgRes
->
count
+=
1
;
pAvgRes
->
sum
.
dsum
+=
plist
[
i
];
pAvgRes
->
sum
.
dsum
+=
plist
[
i
];
}
// pAvgRes->sum.dsum = val;
// pAvgRes->sum.dsum = val;
break
;
}
...
...
@@ -3011,7 +3011,7 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) {
}
}
#else
int64_t
*
pts
=
(
int64_t
*
)
pInput
->
pPTS
->
pData
;
int64_t
*
pts
=
(
int64_t
*
)
pInput
->
pPTS
->
pData
;
for
(
int32_t
i
=
pInput
->
startRowIndex
;
i
<
pInput
->
startRowIndex
+
pInput
->
numOfRows
;
++
i
)
{
if
(
pInputCol
->
hasNull
&&
colDataIsNull
(
pInputCol
,
pInput
->
totalRows
,
i
,
pColAgg
))
{
continue
;
...
...
@@ -3115,61 +3115,61 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
}
}
#else
if
(
!
pInputCol
->
hasNull
)
{
numOfElems
=
1
;
if
(
!
pInputCol
->
hasNull
)
{
numOfElems
=
1
;
int32_t
round
=
pInput
->
numOfRows
>>
2
;
int32_t
reminder
=
pInput
->
numOfRows
&
0x03
;
int32_t
round
=
pInput
->
numOfRows
>>
2
;
int32_t
reminder
=
pInput
->
numOfRows
&
0x03
;
int32_t
tick
=
0
;
for
(
int32_t
i
=
pInput
->
startRowIndex
;
tick
<
round
;
i
+=
4
,
tick
+=
1
)
{
int64_t
cts
=
pts
[
i
];
int32_t
chosen
=
i
;
int32_t
tick
=
0
;
for
(
int32_t
i
=
pInput
->
startRowIndex
;
tick
<
round
;
i
+=
4
,
tick
+=
1
)
{
int64_t
cts
=
pts
[
i
];
int32_t
chosen
=
i
;
if
(
cts
<
pts
[
i
+
1
])
{
cts
=
pts
[
i
+
1
];
chosen
=
i
+
1
;
}
if
(
cts
<
pts
[
i
+
1
])
{
cts
=
pts
[
i
+
1
];
chosen
=
i
+
1
;
}
if
(
cts
<
pts
[
i
+
2
])
{
cts
=
pts
[
i
+
2
];
chosen
=
i
+
2
;
}
if
(
cts
<
pts
[
i
+
2
])
{
cts
=
pts
[
i
+
2
];
chosen
=
i
+
2
;
}
if
(
cts
<
pts
[
i
+
3
])
{
cts
=
pts
[
i
+
3
];
chosen
=
i
+
3
;
}
if
(
cts
<
pts
[
i
+
3
])
{
cts
=
pts
[
i
+
3
];
chosen
=
i
+
3
;
}
if
(
pResInfo
->
numOfRes
==
0
||
pInfo
->
ts
<
cts
)
{
char
*
data
=
colDataGetData
(
pInputCol
,
chosen
);
doSaveCurrentVal
(
pCtx
,
i
,
cts
,
type
,
data
);
pResInfo
->
numOfRes
=
1
;
}
if
(
pResInfo
->
numOfRes
==
0
||
pInfo
->
ts
<
cts
)
{
char
*
data
=
colDataGetData
(
pInputCol
,
chosen
);
doSaveCurrentVal
(
pCtx
,
i
,
cts
,
type
,
data
);
pResInfo
->
numOfRes
=
1
;
}
}
for
(
int32_t
i
=
pInput
->
startRowIndex
+
round
*
4
;
i
<
pInput
->
startRowIndex
+
pInput
->
numOfRows
;
++
i
)
{
if
(
pResInfo
->
numOfRes
==
0
||
pInfo
->
ts
<
pts
[
i
])
{
char
*
data
=
colDataGetData
(
pInputCol
,
i
);
doSaveCurrentVal
(
pCtx
,
i
,
pts
[
i
],
type
,
data
);
pResInfo
->
numOfRes
=
1
;
}
for
(
int32_t
i
=
pInput
->
startRowIndex
+
round
*
4
;
i
<
pInput
->
startRowIndex
+
pInput
->
numOfRows
;
++
i
)
{
if
(
pResInfo
->
numOfRes
==
0
||
pInfo
->
ts
<
pts
[
i
])
{
char
*
data
=
colDataGetData
(
pInputCol
,
i
);
doSaveCurrentVal
(
pCtx
,
i
,
pts
[
i
],
type
,
data
);
pResInfo
->
numOfRes
=
1
;
}
}
}
else
{
for
(
int32_t
i
=
pInput
->
startRowIndex
;
i
<
pInput
->
startRowIndex
+
pInput
->
numOfRows
;
++
i
)
{
if
(
pInputCol
->
hasNull
&&
colDataIsNull
(
pInputCol
,
pInput
->
totalRows
,
i
,
pColAgg
))
{
continue
;
}
}
else
{
for
(
int32_t
i
=
pInput
->
startRowIndex
;
i
<
pInput
->
startRowIndex
+
pInput
->
numOfRows
;
++
i
)
{
if
(
pInputCol
->
hasNull
&&
colDataIsNull
(
pInputCol
,
pInput
->
totalRows
,
i
,
pColAgg
))
{
continue
;
}
numOfElems
++
;
numOfElems
++
;
if
(
pResInfo
->
numOfRes
==
0
||
pInfo
->
ts
<
pts
[
i
])
{
char
*
data
=
colDataGetData
(
pInputCol
,
i
);
doSaveCurrentVal
(
pCtx
,
i
,
pts
[
i
],
type
,
data
);
pResInfo
->
numOfRes
=
1
;
}
if
(
pResInfo
->
numOfRes
==
0
||
pInfo
->
ts
<
pts
[
i
])
{
char
*
data
=
colDataGetData
(
pInputCol
,
i
);
doSaveCurrentVal
(
pCtx
,
i
,
pts
[
i
],
type
,
data
);
pResInfo
->
numOfRes
=
1
;
}
}
}
#endif
#endif
...
...
@@ -3179,7 +3179,7 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
firstlastSaveTupleData
(
pCtx
->
pSrcBlock
,
pInput
->
startRowIndex
,
pCtx
,
pInfo
);
}
// SET_VAL(pResInfo, numOfElems, 1);
// SET_VAL(pResInfo, numOfElems, 1);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -5280,7 +5280,6 @@ int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
return
pInfo
->
numSampled
;
}
bool
getTailFuncEnv
(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
)
{
#if 0
SColumnNode* pCol = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0);
...
...
@@ -6077,11 +6076,19 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t
row
=
0
;
char
st
[
256
]
=
{
0
};
double
totalRawSize
=
pData
->
totalRows
*
pData
->
rowSize
;
double
averageSize
=
0
;
if
(
pData
->
numOfBlocks
!=
0
)
{
averageSize
=
((
double
)
pData
->
totalSize
)
/
pData
->
numOfBlocks
;
}
uint64_t
totalRawSize
=
pData
->
totalRows
*
pData
->
rowSize
;
double
compRatio
=
0
;
if
(
totalRawSize
!=
0
)
{
compRatio
=
pData
->
totalSize
*
100
/
(
double
)
totalRawSize
;
}
int32_t
len
=
sprintf
(
st
+
VARSTR_HEADER_SIZE
,
"Total_Blocks=[%d] Total_Size=[%.2f Kb] Average_size=[%.2f Kb] Compression_Ratio=[%.2f %c]"
,
pData
->
numOfBlocks
,
pData
->
totalSize
/
1024
.
0
,
((
double
)
pData
->
totalSize
)
/
pData
->
numOfBlocks
,
pData
->
totalSize
*
100
/
totalRawSize
,
'%'
);
pData
->
numOfBlocks
,
pData
->
totalSize
/
1024
.
0
,
averageSize
,
compRatio
,
'%'
);
varDataSetLen
(
st
,
len
);
colDataAppend
(
pColInfo
,
row
++
,
st
,
false
);
...
...
tests/parallel_test/cases.task
浏览文件 @
72f6b934
...
...
@@ -321,7 +321,7 @@
,,y,script,./test.sh -f tsim/compress/compress.sim
,,y,script,./test.sh -f tsim/compress/uncompress.sim
,,y,script,./test.sh -f tsim/compute/avg.sim
,,,script,./test.sh -f tsim/compute/block_dist.sim
,,
y
,script,./test.sh -f tsim/compute/block_dist.sim
,,y,script,./test.sh -f tsim/compute/bottom.sim
,,y,script,./test.sh -f tsim/compute/count.sim
,,y,script,./test.sh -f tsim/compute/diff.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录