Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1cac65d8
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看板
提交
1cac65d8
编写于
9月 22, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact more code
上级
1bab3c1b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
97 addition
and
259 deletion
+97
-259
source/dnode/vnode/src/tsdb/tsdbDiskData.c
source/dnode/vnode/src/tsdb/tsdbDiskData.c
+2
-86
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+95
-173
未找到文件。
source/dnode/vnode/src/tsdb/tsdbDiskData.c
浏览文件 @
1cac65d8
...
...
@@ -143,96 +143,12 @@ static int32_t tGnrtDiskCol(SDiskColBuilder *pBuilder, SDiskCol *pDiskCol) {
return
code
;
}
static
FORCE_INLINE
void
tDiskColUpdateSmaBool
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
// TODO
}
static
FORCE_INLINE
void
tDiskColUpdateSmaTinyint
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
int8_t
val
=
*
(
int8_t
*
)
&
pColVal
->
value
.
val
;
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
pBuilder
->
sma
.
min
>
val
)
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
pBuilder
->
sma
.
max
<
val
)
pBuilder
->
sma
.
max
=
val
;
}
static
FORCE_INLINE
void
tDiskColUpdateSmaSmallint
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
int16_t
val
=
*
(
int16_t
*
)
&
pColVal
->
value
.
val
;
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
pBuilder
->
sma
.
min
>
val
)
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
pBuilder
->
sma
.
max
<
val
)
pBuilder
->
sma
.
max
=
val
;
}
static
FORCE_INLINE
void
tDiskColUpdateSmaInt
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
int32_t
val
=
*
(
int32_t
*
)
&
pColVal
->
value
.
val
;
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
pBuilder
->
sma
.
min
>
val
)
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
pBuilder
->
sma
.
max
<
val
)
pBuilder
->
sma
.
max
=
val
;
}
static
FORCE_INLINE
void
tDiskColUpdateBigint
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
int64_t
val
=
*
(
int64_t
*
)
&
pColVal
->
value
.
val
;
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
pBuilder
->
sma
.
min
>
val
)
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
pBuilder
->
sma
.
max
<
val
)
pBuilder
->
sma
.
max
=
val
;
}
static
FORCE_INLINE
void
tDiskColUpdateFloat
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
float
val
=
*
(
float
*
)
&
pColVal
->
value
.
val
;
*
(
double
*
)
&
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
*
(
double
*
)
&
pBuilder
->
sma
.
min
>
val
)
*
(
double
*
)
&
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
*
(
double
*
)
&
pBuilder
->
sma
.
max
<
val
)
*
(
double
*
)
&
pBuilder
->
sma
.
max
=
val
;
}
static
FORCE_INLINE
void
tDiskColUpdateDouble
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
double
val
=
*
(
double
*
)
&
pColVal
->
value
.
val
;
*
(
double
*
)
&
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
*
(
double
*
)
&
pBuilder
->
sma
.
min
>
val
)
*
(
double
*
)
&
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
*
(
double
*
)
&
pBuilder
->
sma
.
max
<
val
)
*
(
double
*
)
&
pBuilder
->
sma
.
max
=
val
;
}
static
FORCE_INLINE
void
tDiskColUpdateUTinyint
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
uint8_t
val
=
*
(
uint8_t
*
)
&
pColVal
->
value
.
val
;
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
pBuilder
->
sma
.
min
>
val
)
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
pBuilder
->
sma
.
max
<
val
)
pBuilder
->
sma
.
max
=
val
;
}
static
FORCE_INLINE
void
tDiskColUpdateUSmallint
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
uint16_t
val
=
*
(
uint16_t
*
)
&
pColVal
->
value
.
val
;
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
pBuilder
->
sma
.
min
>
val
)
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
pBuilder
->
sma
.
max
<
val
)
pBuilder
->
sma
.
max
=
val
;
}
static
FORCE_INLINE
void
tDiskColUpdateUInt
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
uint32_t
val
=
*
(
uint32_t
*
)
&
pColVal
->
value
.
val
;
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
pBuilder
->
sma
.
min
>
val
)
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
pBuilder
->
sma
.
max
<
val
)
pBuilder
->
sma
.
max
=
val
;
}
static
FORCE_INLINE
void
tDiskColUpdateUBigint
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
uint64_t
val
=
*
(
uint64_t
*
)
&
pColVal
->
value
.
val
;
pBuilder
->
sma
.
sum
+=
val
;
if
(
!
pBuilder
->
minSet
||
pBuilder
->
sma
.
min
>
val
)
pBuilder
->
sma
.
min
=
val
;
if
(
!
pBuilder
->
maxSet
||
pBuilder
->
sma
.
max
<
val
)
pBuilder
->
sma
.
max
=
val
;
}
static
void
(
*
tDiskColUpdateSmaImpl
[])(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
=
{
NULL
,
// TSDB_DATA_TYPE_NULL
tDiskColUpdateSmaBool
,
// TSDB_DATA_TYPE_BOOL
tDiskColUpdateSmaTinyint
,
// TSDB_DATA_TYPE_TINYINT
tDiskColUpdateSmaSmallint
,
// TSDB_DATA_TYPE_SMALLINT
tDiskColUpdateSmaInt
,
// TSDB_DATA_TYPE_INT
tDiskColUpdateBigint
,
// TSDB_DATA_TYPE_BIGINT
tDiskColUpdateFloat
,
// TSDB_DATA_TYPE_FLOAT
tDiskColUpdateDouble
,
// TSDB_DATA_TYPE_DOUBLE
NULL
,
// TSDB_DATA_TYPE_VARCHAR
tDiskColUpdateBigint
,
// TSDB_DATA_TYPE_TIMESTAMP
NULL
,
// TSDB_DATA_TYPE_NCHAR
tDiskColUpdateUTinyint
,
// TSDB_DATA_TYPE_UTINYINT
tDiskColUpdateUSmallint
,
// TSDB_DATA_TYPE_USMALLINT
tDiskColUpdateUInt
,
// TSDB_DATA_TYPE_UINT
tDiskColUpdateUBigint
,
// TSDB_DATA_TYPE_UBIGINT
NULL
,
// TSDB_DATA_TYPE_JSON
NULL
,
// TSDB_DATA_TYPE_VARBINARY
NULL
,
// TSDB_DATA_TYPE_DECIMAL
NULL
,
// TSDB_DATA_TYPE_BLOB
NULL
,
// TSDB_DATA_TYPE_MEDIUMBLOB
};
extern
void
(
*
tSmaUpdateImpl
[])(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
);
static
FORCE_INLINE
void
tDiskColUpdateSma
(
SDiskColBuilder
*
pBuilder
,
SColVal
*
pColVal
)
{
if
(
pColVal
->
isNone
||
pColVal
->
isNull
)
{
pBuilder
->
sma
.
numOfNull
++
;
}
else
{
t
DiskColUpdateSmaImpl
[
pBuilder
->
type
](
pBuilder
,
pColVal
);
t
SmaUpdateImpl
[
pBuilder
->
type
](
&
pBuilder
->
sma
,
pColVal
,
&
pBuilder
->
minSet
,
&
pBuilder
->
maxSet
);
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
1cac65d8
...
...
@@ -1492,185 +1492,107 @@ int32_t tGetColumnDataAgg(uint8_t *p, SColumnDataAgg *pColAgg) {
return
n
;
}
#define SMA_UPDATE(SUM_V, MIN_V, MAX_V, VAL, MINSET, MAXSET) \
do { \
(SUM_V) += (VAL); \
if (!(MINSET)) { \
(MIN_V) = (VAL); \
(MINSET) = 1; \
} else if ((MIN_V) > (VAL)) { \
(MIN_V) = (VAL); \
} \
if (!(MAXSET)) { \
(MAX_V) = (VAL); \
(MAXSET) = 1; \
} else if ((MAX_V) < (VAL)) { \
(MAX_V) = (VAL); \
} \
} while (0)
static
FORCE_INLINE
void
tSmaUpdateBool
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
int8_t
val
=
*
(
int8_t
*
)
&
pColVal
->
value
.
val
?
1
:
0
;
SMA_UPDATE
(
pColAgg
->
sum
,
pColAgg
->
min
,
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateTinyint
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
int8_t
val
=
*
(
int8_t
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
pColAgg
->
sum
,
pColAgg
->
min
,
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateSmallint
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
int16_t
val
=
*
(
int16_t
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
pColAgg
->
sum
,
pColAgg
->
min
,
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateInt
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
int32_t
val
=
*
(
int32_t
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
pColAgg
->
sum
,
pColAgg
->
min
,
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateBigint
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
int64_t
val
=
*
(
int64_t
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
pColAgg
->
sum
,
pColAgg
->
min
,
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateFloat
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
float
val
=
*
(
float
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
*
(
double
*
)
&
pColAgg
->
sum
,
*
(
double
*
)
&
pColAgg
->
min
,
*
(
double
*
)
&
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateDouble
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
double
val
=
*
(
double
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
*
(
double
*
)
&
pColAgg
->
sum
,
*
(
double
*
)
&
pColAgg
->
min
,
*
(
double
*
)
&
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateUTinyint
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
uint8_t
val
=
*
(
uint8_t
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
pColAgg
->
sum
,
pColAgg
->
min
,
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateUSmallint
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
uint16_t
val
=
*
(
uint16_t
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
pColAgg
->
sum
,
pColAgg
->
min
,
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateUInt
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
uint32_t
val
=
*
(
uint32_t
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
pColAgg
->
sum
,
pColAgg
->
min
,
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
static
FORCE_INLINE
void
tSmaUpdateUBigint
(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
{
uint64_t
val
=
*
(
uint64_t
*
)
&
pColVal
->
value
.
val
;
SMA_UPDATE
(
pColAgg
->
sum
,
pColAgg
->
min
,
pColAgg
->
max
,
val
,
*
minSet
,
*
maxSet
);
}
void
(
*
tSmaUpdateImpl
[])(
SColumnDataAgg
*
pColAgg
,
SColVal
*
pColVal
,
uint8_t
*
minSet
,
uint8_t
*
maxSet
)
=
{
NULL
,
tSmaUpdateBool
,
// TSDB_DATA_TYPE_BOOL
tSmaUpdateTinyint
,
// TSDB_DATA_TYPE_TINYINT
tSmaUpdateSmallint
,
// TSDB_DATA_TYPE_SMALLINT
tSmaUpdateInt
,
// TSDB_DATA_TYPE_INT
tSmaUpdateBigint
,
// TSDB_DATA_TYPE_BIGINT
tSmaUpdateFloat
,
// TSDB_DATA_TYPE_FLOAT
tSmaUpdateDouble
,
// TSDB_DATA_TYPE_DOUBLE
NULL
,
// TSDB_DATA_TYPE_VARCHAR
tSmaUpdateBigint
,
// TSDB_DATA_TYPE_TIMESTAMP
NULL
,
// TSDB_DATA_TYPE_NCHAR
tSmaUpdateUTinyint
,
// TSDB_DATA_TYPE_UTINYINT
tSmaUpdateUSmallint
,
// TSDB_DATA_TYPE_USMALLINT
tSmaUpdateUInt
,
// TSDB_DATA_TYPE_UINT
tSmaUpdateUBigint
,
// TSDB_DATA_TYPE_UBIGINT
NULL
,
// TSDB_DATA_TYPE_JSON
NULL
,
// TSDB_DATA_TYPE_VARBINARY
NULL
,
// TSDB_DATA_TYPE_DECIMAL
NULL
,
// TSDB_DATA_TYPE_BLOB
NULL
,
// TSDB_DATA_TYPE_MEDIUMBLOB
};
void
tsdbCalcColDataSMA
(
SColData
*
pColData
,
SColumnDataAgg
*
pColAgg
)
{
SColVal
colVal
;
SColVal
*
pColVal
=
&
colVal
;
memset
(
pColAgg
,
0
,
sizeof
(
*
pColAgg
));
bool
minAssigned
=
false
;
bool
maxAssigned
=
false
;
*
pColAgg
=
(
SColumnDataAgg
){.
colId
=
pColData
->
cid
};
uint8_t
minSet
=
0
;
uint8_t
maxSet
=
0
;
SColVal
cv
;
for
(
int32_t
iVal
=
0
;
iVal
<
pColData
->
nVal
;
iVal
++
)
{
tColDataGetValue
(
pColData
,
iVal
,
pColVal
);
tColDataGetValue
(
pColData
,
iVal
,
&
cv
);
if
(
pColVal
->
isNone
||
pColVal
->
isNull
)
{
if
(
cv
.
isNone
||
cv
.
isNull
)
{
pColAgg
->
numOfNull
++
;
}
else
{
switch
(
pColData
->
type
)
{
case
TSDB_DATA_TYPE_NULL
:
break
;
case
TSDB_DATA_TYPE_BOOL
:
break
;
case
TSDB_DATA_TYPE_TINYINT
:
{
int8_t
i8
=
*
(
int8_t
*
)
&
colVal
.
value
.
val
;
pColAgg
->
sum
+=
i8
;
if
(
!
minAssigned
||
pColAgg
->
min
>
i8
)
{
pColAgg
->
min
=
i8
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
pColAgg
->
max
<
i8
)
{
pColAgg
->
max
=
i8
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
int16_t
i16
=
*
(
int16_t
*
)
&
colVal
.
value
.
val
;
pColAgg
->
sum
+=
i16
;
if
(
!
minAssigned
||
pColAgg
->
min
>
i16
)
{
pColAgg
->
min
=
i16
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
pColAgg
->
max
<
i16
)
{
pColAgg
->
max
=
i16
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_INT
:
{
int32_t
i32
=
*
(
int32_t
*
)
&
colVal
.
value
.
val
;
pColAgg
->
sum
+=
i32
;
if
(
!
minAssigned
||
pColAgg
->
min
>
i32
)
{
pColAgg
->
min
=
i32
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
pColAgg
->
max
<
i32
)
{
pColAgg
->
max
=
i32
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_BIGINT
:
{
int64_t
i64
=
*
(
int64_t
*
)
&
colVal
.
value
.
val
;
pColAgg
->
sum
+=
i64
;
if
(
!
minAssigned
||
pColAgg
->
min
>
i64
)
{
pColAgg
->
min
=
i64
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
pColAgg
->
max
<
i64
)
{
pColAgg
->
max
=
i64
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
float
f
=
*
(
float
*
)
&
colVal
.
value
.
val
;
*
(
double
*
)(
&
pColAgg
->
sum
)
+=
f
;
if
(
!
minAssigned
||
*
(
double
*
)(
&
pColAgg
->
min
)
>
f
)
{
*
(
double
*
)(
&
pColAgg
->
min
)
=
f
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
*
(
double
*
)(
&
pColAgg
->
max
)
<
f
)
{
*
(
double
*
)(
&
pColAgg
->
max
)
=
f
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
double
d
=
*
(
double
*
)
&
colVal
.
value
.
val
;
*
(
double
*
)(
&
pColAgg
->
sum
)
+=
d
;
if
(
!
minAssigned
||
*
(
double
*
)(
&
pColAgg
->
min
)
>
d
)
{
*
(
double
*
)(
&
pColAgg
->
min
)
=
d
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
*
(
double
*
)(
&
pColAgg
->
max
)
<
d
)
{
*
(
double
*
)(
&
pColAgg
->
max
)
=
d
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_VARCHAR
:
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
int64_t
ts
=
*
(
int64_t
*
)
&
colVal
.
value
.
val
;
if
(
!
minAssigned
||
pColAgg
->
min
>
ts
)
{
pColAgg
->
min
=
ts
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
pColAgg
->
max
<
ts
)
{
pColAgg
->
max
=
ts
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_NCHAR
:
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
{
uint8_t
u8
=
*
(
uint8_t
*
)
&
colVal
.
value
.
val
;
pColAgg
->
sum
+=
u8
;
if
(
!
minAssigned
||
pColAgg
->
min
>
u8
)
{
pColAgg
->
min
=
u8
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
pColAgg
->
max
<
u8
)
{
pColAgg
->
max
=
u8
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
uint16_t
u16
=
*
(
uint16_t
*
)
&
colVal
.
value
.
val
;
pColAgg
->
sum
+=
u16
;
if
(
!
minAssigned
||
pColAgg
->
min
>
u16
)
{
pColAgg
->
min
=
u16
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
pColAgg
->
max
<
u16
)
{
pColAgg
->
max
=
u16
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_UINT
:
{
uint32_t
u32
=
*
(
uint32_t
*
)
&
colVal
.
value
.
val
;
pColAgg
->
sum
+=
u32
;
if
(
!
minAssigned
||
pColAgg
->
min
>
u32
)
{
pColAgg
->
min
=
u32
;
minAssigned
=
true
;
}
if
(
!
minAssigned
||
pColAgg
->
max
<
u32
)
{
pColAgg
->
max
=
u32
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
uint64_t
u64
=
*
(
uint64_t
*
)
&
colVal
.
value
.
val
;
pColAgg
->
sum
+=
u64
;
if
(
!
minAssigned
||
pColAgg
->
min
>
u64
)
{
pColAgg
->
min
=
u64
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
pColAgg
->
max
<
u64
)
{
pColAgg
->
max
=
u64
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_JSON
:
break
;
case
TSDB_DATA_TYPE_VARBINARY
:
break
;
case
TSDB_DATA_TYPE_DECIMAL
:
break
;
case
TSDB_DATA_TYPE_BLOB
:
break
;
case
TSDB_DATA_TYPE_MEDIUMBLOB
:
break
;
default:
ASSERT
(
0
);
}
tSmaUpdateImpl
[
pColData
->
type
](
pColAgg
,
&
cv
,
&
minSet
,
&
maxSet
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录