Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f8619dfb
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
f8619dfb
编写于
9月 21, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact code for further refact
上级
1d76bd6d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
80 addition
and
163 deletion
+80
-163
include/common/tdataformat.h
include/common/tdataformat.h
+1
-11
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+6
-90
source/common/src/trow.c
source/common/src/trow.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+3
-3
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+69
-58
未找到文件。
include/common/tdataformat.h
浏览文件 @
f8619dfb
...
...
@@ -154,17 +154,7 @@ struct STSRowBuilder {
struct
SValue
{
union
{
int8_t
i8
;
// TSDB_DATA_TYPE_BOOL||TSDB_DATA_TYPE_TINYINT
uint8_t
u8
;
// TSDB_DATA_TYPE_UTINYINT
int16_t
i16
;
// TSDB_DATA_TYPE_SMALLINT
uint16_t
u16
;
// TSDB_DATA_TYPE_USMALLINT
int32_t
i32
;
// TSDB_DATA_TYPE_INT
uint32_t
u32
;
// TSDB_DATA_TYPE_UINT
int64_t
i64
;
// TSDB_DATA_TYPE_BIGINT
uint64_t
u64
;
// TSDB_DATA_TYPE_UBIGINT
TSKEY
ts
;
// TSDB_DATA_TYPE_TIMESTAMP
float
f
;
// TSDB_DATA_TYPE_FLOAT
double
d
;
// TSDB_DATA_TYPE_DOUBLE
int64_t
val
;
struct
{
uint32_t
nData
;
uint8_t
*
pData
;
...
...
source/common/src/tdataformat.c
浏览文件 @
f8619dfb
...
...
@@ -33,105 +33,21 @@ typedef struct {
// SValue
int32_t
tPutValue
(
uint8_t
*
p
,
SValue
*
pValue
,
int8_t
type
)
{
int32_t
n
=
0
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
n
+=
tPutBinary
(
p
?
p
+
n
:
p
,
pValue
->
pData
,
pValue
->
nData
);
return
tPutBinary
(
p
,
pValue
->
pData
,
pValue
->
nData
);
}
else
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
n
+=
tPutI8
(
p
?
p
+
n
:
p
,
pValue
->
i8
?
1
:
0
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
n
+=
tPutI8
(
p
?
p
+
n
:
p
,
pValue
->
i8
);
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
n
+=
tPutI16
(
p
?
p
+
n
:
p
,
pValue
->
i16
);
break
;
case
TSDB_DATA_TYPE_INT
:
n
+=
tPutI32
(
p
?
p
+
n
:
p
,
pValue
->
i32
);
break
;
case
TSDB_DATA_TYPE_BIGINT
:
n
+=
tPutI64
(
p
?
p
+
n
:
p
,
pValue
->
i64
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
n
+=
tPutFloat
(
p
?
p
+
n
:
p
,
pValue
->
f
);
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
n
+=
tPutDouble
(
p
?
p
+
n
:
p
,
pValue
->
d
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
n
+=
tPutI64
(
p
?
p
+
n
:
p
,
pValue
->
ts
);
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
n
+=
tPutU8
(
p
?
p
+
n
:
p
,
pValue
->
u8
);
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
n
+=
tPutU16
(
p
?
p
+
n
:
p
,
pValue
->
u16
);
break
;
case
TSDB_DATA_TYPE_UINT
:
n
+=
tPutU32
(
p
?
p
+
n
:
p
,
pValue
->
u32
);
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
n
+=
tPutU64
(
p
?
p
+
n
:
p
,
pValue
->
u64
);
break
;
default:
ASSERT
(
0
);
}
if
(
p
)
memcpy
(
p
,
&
pValue
->
val
,
tDataTypes
[
type
].
bytes
);
return
tDataTypes
[
type
].
bytes
;
}
return
n
;
}
int32_t
tGetValue
(
uint8_t
*
p
,
SValue
*
pValue
,
int8_t
type
)
{
int32_t
n
=
0
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
n
+=
tGetBinary
(
p
,
&
pValue
->
pData
,
pValue
?
&
pValue
->
nData
:
NULL
);
return
tGetBinary
(
p
,
&
pValue
->
pData
,
pValue
?
&
pValue
->
nData
:
NULL
);
}
else
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
n
+=
tGetI8
(
p
,
&
pValue
->
i8
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
n
+=
tGetI8
(
p
,
&
pValue
->
i8
);
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
n
+=
tGetI16
(
p
,
&
pValue
->
i16
);
break
;
case
TSDB_DATA_TYPE_INT
:
n
+=
tGetI32
(
p
,
&
pValue
->
i32
);
break
;
case
TSDB_DATA_TYPE_BIGINT
:
n
+=
tGetI64
(
p
,
&
pValue
->
i64
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
n
+=
tGetFloat
(
p
,
&
pValue
->
f
);
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
n
+=
tGetDouble
(
p
,
&
pValue
->
d
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
n
+=
tGetI64
(
p
,
&
pValue
->
ts
);
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
n
+=
tGetU8
(
p
,
&
pValue
->
u8
);
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
n
+=
tGetU16
(
p
,
&
pValue
->
u16
);
break
;
case
TSDB_DATA_TYPE_UINT
:
n
+=
tGetU32
(
p
,
&
pValue
->
u32
);
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
n
+=
tGetU64
(
p
,
&
pValue
->
u64
);
break
;
default:
ASSERT
(
0
);
}
memcpy
(
&
pValue
->
val
,
p
,
tDataTypes
[
type
].
bytes
);
return
tDataTypes
[
type
].
bytes
;
}
return
n
;
}
int
tValueCmprFn
(
const
SValue
*
pValue1
,
const
SValue
*
pValue2
,
int8_t
type
)
{
...
...
source/common/src/trow.c
浏览文件 @
f8619dfb
...
...
@@ -689,7 +689,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) {
memcpy
(
varDataVal
(
varBuf
),
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
val
=
varBuf
;
}
else
{
val
=
(
const
void
*
)
&
pColVal
->
value
.
i64
;
val
=
(
const
void
*
)
&
pColVal
->
value
.
val
;
}
}
else
{
pColVal
=
NULL
;
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
f8619dfb
...
...
@@ -260,7 +260,7 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, STSRow *row, STsdb
SLastCol
*
tTsVal
=
(
SLastCol
*
)
taosArrayGet
(
pLast
,
iCol
);
if
(
keyTs
>
tTsVal
->
ts
)
{
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
0
];
SColVal
tColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
ts
=
keyTs
});
SColVal
tColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
keyTs
});
taosArraySet
(
pLast
,
iCol
,
&
(
SLastCol
){.
ts
=
keyTs
,
.
colVal
=
tColVal
});
}
...
...
@@ -1048,7 +1048,7 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, STSRow **ppRo
lastRowTs
=
TSDBROW_TS
(
pRow
);
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
0
];
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
ts
=
lastRowTs
});
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
lastRowTs
});
if
(
taosArrayPush
(
pColArray
,
pColVal
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
...
...
@@ -1147,7 +1147,7 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray) {
lastRowTs
=
rowTs
;
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
0
];
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
ts
=
lastRowTs
});
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
lastRowTs
});
if
(
taosArrayPush
(
pColArray
,
&
(
SLastCol
){.
ts
=
lastRowTs
,
.
colVal
=
*
pColVal
})
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
f8619dfb
...
...
@@ -649,7 +649,7 @@ int32_t tRowMergerInit2(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRo
ASSERT
(
pTColumn
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
ts
=
key
.
ts
});
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
key
.
ts
});
if
(
taosArrayPush
(
pMerger
->
pArray
,
pColVal
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
...
...
@@ -690,7 +690,7 @@ int32_t tRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) {
STColumn
*
pTColumn
;
int32_t
iCol
,
jCol
=
1
;
ASSERT
(((
SColVal
*
)
pMerger
->
pArray
->
pData
)
->
value
.
ts
==
key
.
ts
);
ASSERT
(((
SColVal
*
)
pMerger
->
pArray
->
pData
)
->
value
.
val
==
key
.
ts
);
for
(
iCol
=
1
;
iCol
<
pMerger
->
pTSchema
->
numOfCols
&&
jCol
<
pTSchema
->
numOfCols
;
++
iCol
)
{
pTColumn
=
&
pMerger
->
pTSchema
->
columns
[
iCol
];
...
...
@@ -744,7 +744,7 @@ int32_t tRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) {
ASSERT
(
pTColumn
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
ts
=
key
.
ts
});
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
key
.
ts
});
if
(
taosArrayPush
(
pMerger
->
pArray
,
pColVal
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
...
...
@@ -770,7 +770,7 @@ int32_t tRowMerge(SRowMerger *pMerger, TSDBROW *pRow) {
TSDBKEY
key
=
TSDBROW_KEY
(
pRow
);
SColVal
*
pColVal
=
&
(
SColVal
){
0
};
ASSERT
(((
SColVal
*
)
pMerger
->
pArray
->
pData
)
->
value
.
ts
==
key
.
ts
);
ASSERT
(((
SColVal
*
)
pMerger
->
pArray
->
pData
)
->
value
.
val
==
key
.
ts
);
for
(
int32_t
iCol
=
1
;
iCol
<
pMerger
->
pTSchema
->
numOfCols
;
iCol
++
)
{
tsdbRowGetColVal
(
pRow
,
pMerger
->
pTSchema
,
iCol
,
pColVal
);
...
...
@@ -1513,73 +1513,79 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
case
TSDB_DATA_TYPE_BOOL
:
break
;
case
TSDB_DATA_TYPE_TINYINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
i8
;
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i8
)
{
pColAgg
->
min
=
colVal
.
value
.
i8
;
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
<
colVal
.
value
.
i8
)
{
pColAgg
->
max
=
colVal
.
value
.
i8
;
if
(
!
maxAssigned
||
pColAgg
->
max
<
i8
)
{
pColAgg
->
max
=
i8
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
i16
;
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i16
)
{
pColAgg
->
min
=
colVal
.
value
.
i16
;
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
<
colVal
.
value
.
i16
)
{
pColAgg
->
max
=
colVal
.
value
.
i16
;
if
(
!
maxAssigned
||
pColAgg
->
max
<
i16
)
{
pColAgg
->
max
=
i16
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_INT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
i32
;
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i32
)
{
pColAgg
->
min
=
colVal
.
value
.
i32
;
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
<
colVal
.
value
.
i32
)
{
pColAgg
->
max
=
colVal
.
value
.
i32
;
if
(
!
maxAssigned
||
pColAgg
->
max
<
i32
)
{
pColAgg
->
max
=
i32
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_BIGINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
i64
;
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i64
)
{
pColAgg
->
min
=
colVal
.
value
.
i64
;
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
<
colVal
.
value
.
i64
)
{
pColAgg
->
max
=
colVal
.
value
.
i64
;
if
(
!
maxAssigned
||
pColAgg
->
max
<
i64
)
{
pColAgg
->
max
=
i64
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
*
(
double
*
)(
&
pColAgg
->
sum
)
+=
colVal
.
value
.
f
;
if
(
!
minAssigned
||
*
(
double
*
)(
&
pColAgg
->
min
)
>
colVal
.
value
.
f
)
{
*
(
double
*
)(
&
pColAgg
->
min
)
=
colVal
.
value
.
f
;
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
)
<
colVal
.
value
.
f
)
{
*
(
double
*
)(
&
pColAgg
->
max
)
=
colVal
.
value
.
f
;
if
(
!
maxAssigned
||
*
(
double
*
)(
&
pColAgg
->
max
)
<
f
)
{
*
(
double
*
)(
&
pColAgg
->
max
)
=
f
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
*
(
double
*
)(
&
pColAgg
->
sum
)
+=
colVal
.
value
.
d
;
if
(
!
minAssigned
||
*
(
double
*
)(
&
pColAgg
->
min
)
>
colVal
.
value
.
d
)
{
*
(
double
*
)(
&
pColAgg
->
min
)
=
colVal
.
value
.
d
;
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
)
<
colVal
.
value
.
d
)
{
*
(
double
*
)(
&
pColAgg
->
max
)
=
colVal
.
value
.
d
;
if
(
!
maxAssigned
||
*
(
double
*
)(
&
pColAgg
->
max
)
<
d
)
{
*
(
double
*
)(
&
pColAgg
->
max
)
=
d
;
maxAssigned
=
true
;
}
break
;
...
...
@@ -1587,12 +1593,13 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
case
TSDB_DATA_TYPE_VARCHAR
:
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
i64
)
{
pColAgg
->
min
=
colVal
.
value
.
i64
;
int64_t
ts
=
*
(
int64_t
*
)
&
colVal
.
value
.
val
;
if
(
!
minAssigned
||
pColAgg
->
min
>
ts
)
{
pColAgg
->
min
=
ts
;
minAssigned
=
true
;
}
if
(
!
maxAssigned
||
pColAgg
->
max
<
colVal
.
value
.
i64
)
{
pColAgg
->
max
=
colVal
.
value
.
i64
;
if
(
!
maxAssigned
||
pColAgg
->
max
<
ts
)
{
pColAgg
->
max
=
ts
;
maxAssigned
=
true
;
}
break
;
...
...
@@ -1600,49 +1607,53 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
case
TSDB_DATA_TYPE_NCHAR
:
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
u8
;
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
u8
)
{
pColAgg
->
min
=
colVal
.
value
.
u8
;
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
<
colVal
.
value
.
u8
)
{
pColAgg
->
max
=
colVal
.
value
.
u8
;
if
(
!
maxAssigned
||
pColAgg
->
max
<
u8
)
{
pColAgg
->
max
=
u8
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
u16
;
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
u16
)
{
pColAgg
->
min
=
colVal
.
value
.
u16
;
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
<
colVal
.
value
.
u16
)
{
pColAgg
->
max
=
colVal
.
value
.
u16
;
if
(
!
maxAssigned
||
pColAgg
->
max
<
u16
)
{
pColAgg
->
max
=
u16
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_UINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
u32
;
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
u32
)
{
pColAgg
->
min
=
colVal
.
value
.
u32
;
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
<
colVal
.
value
.
u32
)
{
pColAgg
->
max
=
colVal
.
value
.
u32
;
if
(
!
minAssigned
||
pColAgg
->
max
<
u32
)
{
pColAgg
->
max
=
u32
;
maxAssigned
=
true
;
}
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
pColAgg
->
sum
+=
colVal
.
value
.
u64
;
if
(
!
minAssigned
||
pColAgg
->
min
>
colVal
.
value
.
u64
)
{
pColAgg
->
min
=
colVal
.
value
.
u64
;
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
<
colVal
.
value
.
u64
)
{
pColAgg
->
max
=
colVal
.
value
.
u64
;
if
(
!
maxAssigned
||
pColAgg
->
max
<
u64
)
{
pColAgg
->
max
=
u64
;
maxAssigned
=
true
;
}
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录