Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
57b9eee4
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
57b9eee4
编写于
8月 17, 2022
作者:
H
Hui Li
提交者:
GitHub
8月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16139 from taosdata/szhou/fixbugs
fix: source ts column error
上级
e7c542bf
aeec35ed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
55 addition
and
29 deletion
+55
-29
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+48
-22
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+6
-6
未找到文件。
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
57b9eee4
...
@@ -1467,6 +1467,10 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
...
@@ -1467,6 +1467,10 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
SColVal
colVal
;
SColVal
colVal
;
SColVal
*
pColVal
=
&
colVal
;
SColVal
*
pColVal
=
&
colVal
;
memset
(
pColAgg
,
0
,
sizeof
(
*
pColAgg
));
bool
minAssigned
=
false
;
bool
maxAssigned
=
false
;
*
pColAgg
=
(
SColumnDataAgg
){.
colId
=
pColData
->
cid
};
*
pColAgg
=
(
SColumnDataAgg
){.
colId
=
pColData
->
cid
};
for
(
int32_t
iVal
=
0
;
iVal
<
pColData
->
nVal
;
iVal
++
)
{
for
(
int32_t
iVal
=
0
;
iVal
<
pColData
->
nVal
;
iVal
++
)
{
tColDataGetValue
(
pColData
,
iVal
,
pColVal
);
tColDataGetValue
(
pColData
,
iVal
,
pColVal
);
...
@@ -1481,72 +1485,86 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
...
@@ -1481,72 +1485,86 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
break
;
break
;
case
TSDB_DATA_TYPE_TINYINT
:
{
case
TSDB_DATA_TYPE_TINYINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
i8
;
pColAgg
->
sum
+=
colVal
.
value
.
i8
;
if
(
pColAgg
->
min
>
colVal
.
value
.
i8
)
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i8
)
{
pColAgg
->
min
=
colVal
.
value
.
i8
;
pColAgg
->
min
=
colVal
.
value
.
i8
;
minAssigned
=
true
;
}
}
if
(
pColAgg
->
max
<
colVal
.
value
.
i8
)
{
if
(
!
maxAssigned
||
pColAgg
->
max
<
colVal
.
value
.
i8
)
{
pColAgg
->
max
=
colVal
.
value
.
i8
;
pColAgg
->
max
=
colVal
.
value
.
i8
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
case
TSDB_DATA_TYPE_SMALLINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
i16
;
pColAgg
->
sum
+=
colVal
.
value
.
i16
;
if
(
pColAgg
->
min
>
colVal
.
value
.
i16
)
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i16
)
{
pColAgg
->
min
=
colVal
.
value
.
i16
;
pColAgg
->
min
=
colVal
.
value
.
i16
;
minAssigned
=
true
;
}
}
if
(
pColAgg
->
max
<
colVal
.
value
.
i16
)
{
if
(
!
maxAssigned
||
pColAgg
->
max
<
colVal
.
value
.
i16
)
{
pColAgg
->
max
=
colVal
.
value
.
i16
;
pColAgg
->
max
=
colVal
.
value
.
i16
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_INT
:
{
case
TSDB_DATA_TYPE_INT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
i32
;
pColAgg
->
sum
+=
colVal
.
value
.
i32
;
if
(
pColAgg
->
min
>
colVal
.
value
.
i32
)
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i32
)
{
pColAgg
->
min
=
colVal
.
value
.
i32
;
pColAgg
->
min
=
colVal
.
value
.
i32
;
minAssigned
=
true
;
}
}
if
(
pColAgg
->
max
<
colVal
.
value
.
i32
)
{
if
(
!
maxAssigned
||
pColAgg
->
max
<
colVal
.
value
.
i32
)
{
pColAgg
->
max
=
colVal
.
value
.
i32
;
pColAgg
->
max
=
colVal
.
value
.
i32
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_BIGINT
:
{
case
TSDB_DATA_TYPE_BIGINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
i64
;
pColAgg
->
sum
+=
colVal
.
value
.
i64
;
if
(
pColAgg
->
min
>
colVal
.
value
.
i64
)
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i64
)
{
pColAgg
->
min
=
colVal
.
value
.
i64
;
pColAgg
->
min
=
colVal
.
value
.
i64
;
minAssigned
=
true
;
}
}
if
(
pColAgg
->
max
<
colVal
.
value
.
i64
)
{
if
(
!
maxAssigned
||
pColAgg
->
max
<
colVal
.
value
.
i64
)
{
pColAgg
->
max
=
colVal
.
value
.
i64
;
pColAgg
->
max
=
colVal
.
value
.
i64
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_FLOAT
:
{
case
TSDB_DATA_TYPE_FLOAT
:
{
*
(
double
*
)(
&
pColAgg
->
sum
)
+=
colVal
.
value
.
f
;
*
(
double
*
)(
&
pColAgg
->
sum
)
+=
colVal
.
value
.
f
;
if
(
*
(
double
*
)(
&
pColAgg
->
min
)
>
colVal
.
value
.
f
)
{
if
(
!
minAssigned
||
*
(
double
*
)(
&
pColAgg
->
min
)
>
colVal
.
value
.
f
)
{
*
(
double
*
)(
&
pColAgg
->
min
)
=
colVal
.
value
.
f
;
*
(
double
*
)(
&
pColAgg
->
min
)
=
colVal
.
value
.
f
;
minAssigned
=
true
;
}
}
if
(
*
(
double
*
)(
&
pColAgg
->
max
)
<
colVal
.
value
.
f
)
{
if
(
!
maxAssigned
||
*
(
double
*
)(
&
pColAgg
->
max
)
<
colVal
.
value
.
f
)
{
*
(
double
*
)(
&
pColAgg
->
max
)
=
colVal
.
value
.
f
;
*
(
double
*
)(
&
pColAgg
->
max
)
=
colVal
.
value
.
f
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
case
TSDB_DATA_TYPE_DOUBLE
:
{
*
(
double
*
)(
&
pColAgg
->
sum
)
+=
colVal
.
value
.
d
;
*
(
double
*
)(
&
pColAgg
->
sum
)
+=
colVal
.
value
.
d
;
if
(
*
(
double
*
)(
&
pColAgg
->
min
)
>
colVal
.
value
.
d
)
{
if
(
!
minAssigned
||
*
(
double
*
)(
&
pColAgg
->
min
)
>
colVal
.
value
.
d
)
{
*
(
double
*
)(
&
pColAgg
->
min
)
=
colVal
.
value
.
d
;
*
(
double
*
)(
&
pColAgg
->
min
)
=
colVal
.
value
.
d
;
minAssigned
=
true
;
}
}
if
(
*
(
double
*
)(
&
pColAgg
->
max
)
<
colVal
.
value
.
d
)
{
if
(
!
maxAssigned
||
*
(
double
*
)(
&
pColAgg
->
max
)
<
colVal
.
value
.
d
)
{
*
(
double
*
)(
&
pColAgg
->
max
)
=
colVal
.
value
.
d
;
*
(
double
*
)(
&
pColAgg
->
max
)
=
colVal
.
value
.
d
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
break
;
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
if
(
pColAgg
->
min
>
colVal
.
value
.
i64
)
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i64
)
{
pColAgg
->
min
=
colVal
.
value
.
i64
;
pColAgg
->
min
=
colVal
.
value
.
i64
;
minAssigned
=
true
;
}
}
if
(
pColAgg
->
max
<
colVal
.
value
.
i64
)
{
if
(
!
maxAssigned
||
pColAgg
->
max
<
colVal
.
value
.
i64
)
{
pColAgg
->
max
=
colVal
.
value
.
i64
;
pColAgg
->
max
=
colVal
.
value
.
i64
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
...
@@ -1554,41 +1572,49 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
...
@@ -1554,41 +1572,49 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
break
;
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
{
case
TSDB_DATA_TYPE_UTINYINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
u8
;
pColAgg
->
sum
+=
colVal
.
value
.
u8
;
if
(
pColAgg
->
min
>
colVal
.
value
.
u8
)
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
u8
)
{
pColAgg
->
min
=
colVal
.
value
.
u8
;
pColAgg
->
min
=
colVal
.
value
.
u8
;
minAssigned
=
true
;
}
}
if
(
pColAgg
->
max
<
colVal
.
value
.
u8
)
{
if
(
!
maxAssigned
||
pColAgg
->
max
<
colVal
.
value
.
u8
)
{
pColAgg
->
max
=
colVal
.
value
.
u8
;
pColAgg
->
max
=
colVal
.
value
.
u8
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
case
TSDB_DATA_TYPE_USMALLINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
u16
;
pColAgg
->
sum
+=
colVal
.
value
.
u16
;
if
(
pColAgg
->
min
>
colVal
.
value
.
u16
)
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
u16
)
{
pColAgg
->
min
=
colVal
.
value
.
u16
;
pColAgg
->
min
=
colVal
.
value
.
u16
;
minAssigned
=
true
;
}
}
if
(
pColAgg
->
max
<
colVal
.
value
.
u16
)
{
if
(
!
maxAssigned
||
pColAgg
->
max
<
colVal
.
value
.
u16
)
{
pColAgg
->
max
=
colVal
.
value
.
u16
;
pColAgg
->
max
=
colVal
.
value
.
u16
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_UINT
:
{
case
TSDB_DATA_TYPE_UINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
u32
;
pColAgg
->
sum
+=
colVal
.
value
.
u32
;
if
(
pColAgg
->
min
>
colVal
.
value
.
u32
)
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
u32
)
{
pColAgg
->
min
=
colVal
.
value
.
u32
;
pColAgg
->
min
=
colVal
.
value
.
u32
;
minAssigned
=
true
;
}
}
if
(
pColAgg
->
max
<
colVal
.
value
.
u32
)
{
if
(
!
minAssigned
||
pColAgg
->
max
<
colVal
.
value
.
u32
)
{
pColAgg
->
max
=
colVal
.
value
.
u32
;
pColAgg
->
max
=
colVal
.
value
.
u32
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
case
TSDB_DATA_TYPE_UBIGINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
u64
;
pColAgg
->
sum
+=
colVal
.
value
.
u64
;
if
(
pColAgg
->
min
>
colVal
.
value
.
u64
)
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
u64
)
{
pColAgg
->
min
=
colVal
.
value
.
u64
;
pColAgg
->
min
=
colVal
.
value
.
u64
;
minAssigned
=
true
;
}
}
if
(
pColAgg
->
max
<
colVal
.
value
.
u64
)
{
if
(
!
maxAssigned
||
pColAgg
->
max
<
colVal
.
value
.
u64
)
{
pColAgg
->
max
=
colVal
.
value
.
u64
;
pColAgg
->
max
=
colVal
.
value
.
u64
;
maxAssigned
=
true
;
}
}
break
;
break
;
}
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
57b9eee4
...
@@ -3315,7 +3315,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
...
@@ -3315,7 +3315,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
taosFillSetStartInfo
(
pInfo
->
pFillInfo
,
0
,
pInfo
->
win
.
ekey
);
taosFillSetStartInfo
(
pInfo
->
pFillInfo
,
0
,
pInfo
->
win
.
ekey
);
}
else
{
}
else
{
blockDataUpdateTsWindow
(
pBlock
,
pInfo
->
primary
TsCol
);
blockDataUpdateTsWindow
(
pBlock
,
pInfo
->
primary
SrcSlotId
);
doApplyScalarCalculation
(
pOperator
,
pBlock
,
order
,
scanFlag
);
doApplyScalarCalculation
(
pOperator
,
pBlock
,
order
,
scanFlag
);
if
(
pInfo
->
curGroupId
==
0
||
pInfo
->
curGroupId
==
pInfo
->
pRes
->
info
.
groupId
)
{
if
(
pInfo
->
curGroupId
==
0
||
pInfo
->
curGroupId
==
pInfo
->
pRes
->
info
.
groupId
)
{
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
57b9eee4
...
@@ -1210,7 +1210,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
...
@@ -1210,7 +1210,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
int64_t
val
=
GET_INT64_VAL
(
tval
);
int64_t
val
=
GET_INT64_VAL
(
tval
);
if
((
prev
<
val
)
^
isMinFunc
)
{
if
((
prev
<
val
)
^
isMinFunc
)
{
pBuf
->
v
=
val
;
*
(
int64_t
*
)
&
pBuf
->
v
=
val
;
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
index
=
findRowIndex
(
pInput
->
startRowIndex
,
pInput
->
numOfRows
,
pCol
,
tval
);
index
=
findRowIndex
(
pInput
->
startRowIndex
,
pInput
->
numOfRows
,
pCol
,
tval
);
doSaveTupleData
(
pCtx
,
index
,
pCtx
->
pSrcBlock
,
&
pBuf
->
tuplePos
);
doSaveTupleData
(
pCtx
,
index
,
pCtx
->
pSrcBlock
,
&
pBuf
->
tuplePos
);
...
@@ -1223,7 +1223,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
...
@@ -1223,7 +1223,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
uint64_t
val
=
GET_UINT64_VAL
(
tval
);
uint64_t
val
=
GET_UINT64_VAL
(
tval
);
if
((
prev
<
val
)
^
isMinFunc
)
{
if
((
prev
<
val
)
^
isMinFunc
)
{
pBuf
->
v
=
val
;
*
(
uint64_t
*
)
&
pBuf
->
v
=
val
;
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
index
=
findRowIndex
(
pInput
->
startRowIndex
,
pInput
->
numOfRows
,
pCol
,
tval
);
index
=
findRowIndex
(
pInput
->
startRowIndex
,
pInput
->
numOfRows
,
pCol
,
tval
);
doSaveTupleData
(
pCtx
,
index
,
pCtx
->
pSrcBlock
,
&
pBuf
->
tuplePos
);
doSaveTupleData
(
pCtx
,
index
,
pCtx
->
pSrcBlock
,
&
pBuf
->
tuplePos
);
...
@@ -1231,11 +1231,11 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
...
@@ -1231,11 +1231,11 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
}
}
}
else
if
(
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
}
else
if
(
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
prev
=
0
;
double
prev
=
0
;
GET_TYPED_DATA
(
prev
,
int64_t
,
type
,
&
pBuf
->
v
);
GET_TYPED_DATA
(
prev
,
double
,
type
,
&
pBuf
->
v
);
double
val
=
GET_DOUBLE_VAL
(
tval
);
double
val
=
GET_DOUBLE_VAL
(
tval
);
if
((
prev
<
val
)
^
isMinFunc
)
{
if
((
prev
<
val
)
^
isMinFunc
)
{
pBuf
->
v
=
val
;
*
(
double
*
)
&
pBuf
->
v
=
val
;
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
index
=
findRowIndex
(
pInput
->
startRowIndex
,
pInput
->
numOfRows
,
pCol
,
tval
);
index
=
findRowIndex
(
pInput
->
startRowIndex
,
pInput
->
numOfRows
,
pCol
,
tval
);
doSaveTupleData
(
pCtx
,
index
,
pCtx
->
pSrcBlock
,
&
pBuf
->
tuplePos
);
doSaveTupleData
(
pCtx
,
index
,
pCtx
->
pSrcBlock
,
&
pBuf
->
tuplePos
);
...
@@ -1243,11 +1243,11 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
...
@@ -1243,11 +1243,11 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
}
}
}
else
if
(
type
==
TSDB_DATA_TYPE_FLOAT
)
{
}
else
if
(
type
==
TSDB_DATA_TYPE_FLOAT
)
{
double
prev
=
0
;
double
prev
=
0
;
GET_TYPED_DATA
(
prev
,
int64_t
,
type
,
&
pBuf
->
v
);
GET_TYPED_DATA
(
prev
,
double
,
type
,
&
pBuf
->
v
);
double
val
=
GET_DOUBLE_VAL
(
tval
);
double
val
=
GET_DOUBLE_VAL
(
tval
);
if
((
prev
<
val
)
^
isMinFunc
)
{
if
((
prev
<
val
)
^
isMinFunc
)
{
pBuf
->
v
=
val
;
*
(
double
*
)
&
pBuf
->
v
=
val
;
}
}
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录