Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0d39f49d
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看板
提交
0d39f49d
编写于
11月 27, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
a1256ac8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
55 addition
and
55 deletion
+55
-55
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+55
-55
未找到文件。
source/common/src/tdataformat.c
浏览文件 @
0d39f49d
...
...
@@ -1259,25 +1259,25 @@ void tColDataClear(SColData *pColData) {
pColData
->
nData
=
0
;
}
static
FORCE_INLINE
int32_t
tColDataPutValue
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataPutValue
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
if
(
IS_VAR_DATA_TYPE
(
pColData
->
type
))
{
code
=
tRealloc
((
uint8_t
**
)(
&
pColData
->
aOffset
),
sizeof
(
int32_t
)
*
(
pColData
->
nVal
+
1
)
);
code
=
tRealloc
((
uint8_t
**
)(
&
pColData
->
aOffset
),
(
pColData
->
nVal
+
1
)
<<
2
);
if
(
code
)
goto
_exit
;
pColData
->
aOffset
[
pColData
->
nVal
]
=
pColData
->
nData
;
if
(
pColVal
->
value
.
nData
)
{
code
=
tRealloc
(
&
pColData
->
pData
,
pColData
->
nData
+
pColVal
->
value
.
nData
);
if
(
nData
)
{
code
=
tRealloc
(
&
pColData
->
pData
,
pColData
->
nData
+
nData
);
if
(
code
)
goto
_exit
;
memcpy
(
pColData
->
pData
+
pColData
->
nData
,
p
ColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
pColData
->
nData
+=
pColVal
->
value
.
nData
;
memcpy
(
pColData
->
pData
+
pColData
->
nData
,
p
Data
,
nData
);
pColData
->
nData
+=
nData
;
}
}
else
{
ASSERT
(
pColData
->
nData
==
tDataTypes
[
pColData
->
type
].
bytes
*
pColData
->
nVal
);
code
=
tRealloc
(
&
pColData
->
pData
,
pColData
->
nData
+
tDataTypes
[
pColData
->
type
].
bytes
);
if
(
code
)
goto
_exit
;
memcpy
(
pColData
->
pData
+
pColData
->
nData
,
&
pColVal
->
value
.
val
,
tDataTypes
[
pColData
->
type
].
bytes
);
memcpy
(
pColData
->
pData
+
pColData
->
nData
,
pData
,
tDataTypes
[
pColData
->
type
].
bytes
);
pColData
->
nData
+=
tDataTypes
[
pColData
->
type
].
bytes
;
}
pColData
->
nVal
++
;
...
...
@@ -1285,21 +1285,21 @@ static FORCE_INLINE int32_t tColDataPutValue(SColData *pColData, SColVal *pColVa
_exit:
return
code
;
}
static
FORCE_INLINE
int32_t
tColDataAppendValue00
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue00
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
pColData
->
flag
=
HAS_VALUE
;
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue01
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue01
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
pColData
->
flag
=
HAS_NONE
;
pColData
->
nVal
++
;
return
0
;
}
static
FORCE_INLINE
int32_t
tColDataAppendValue02
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue02
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
pColData
->
flag
=
HAS_NULL
;
pColData
->
nVal
++
;
return
0
;
}
static
FORCE_INLINE
int32_t
tColDataAppendValue10
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue10
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
int32_t
nBit
=
BIT1_SIZE
(
pColData
->
nVal
+
1
);
...
...
@@ -1325,13 +1325,13 @@ static FORCE_INLINE int32_t tColDataAppendValue10(SColData *pColData, SColVal *p
}
}
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue11
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue11
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
pColData
->
nVal
++
;
return
0
;
}
static
FORCE_INLINE
int32_t
tColDataAppendValue12
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue12
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
int32_t
nBit
=
BIT1_SIZE
(
pColData
->
nVal
+
1
);
...
...
@@ -1346,7 +1346,7 @@ static FORCE_INLINE int32_t tColDataAppendValue12(SColData *pColData, SColVal *p
return
code
;
}
static
FORCE_INLINE
int32_t
tColDataAppendValue20
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue20
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
int32_t
nBit
=
BIT1_SIZE
(
pColData
->
nVal
+
1
);
...
...
@@ -1372,9 +1372,9 @@ static FORCE_INLINE int32_t tColDataAppendValue20(SColData *pColData, SColVal *p
}
}
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue21
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue21
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
int32_t
nBit
=
BIT1_SIZE
(
pColData
->
nVal
+
1
);
...
...
@@ -1389,11 +1389,11 @@ static FORCE_INLINE int32_t tColDataAppendValue21(SColData *pColData, SColVal *p
return
code
;
}
static
FORCE_INLINE
int32_t
tColDataAppendValue22
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue22
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
pColData
->
nVal
++
;
return
0
;
}
static
FORCE_INLINE
int32_t
tColDataAppendValue30
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue30
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
pColData
->
flag
|=
HAS_VALUE
;
...
...
@@ -1424,9 +1424,9 @@ static FORCE_INLINE int32_t tColDataAppendValue30(SColData *pColData, SColVal *p
}
}
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue31
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue31
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
code
=
tRealloc
(
&
pColData
->
pBitMap
,
BIT1_SIZE
(
pColData
->
nVal
+
1
));
...
...
@@ -1437,7 +1437,7 @@ static FORCE_INLINE int32_t tColDataAppendValue31(SColData *pColData, SColVal *p
return
code
;
}
static
FORCE_INLINE
int32_t
tColDataAppendValue32
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue32
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
code
=
tRealloc
(
&
pColData
->
pBitMap
,
BIT1_SIZE
(
pColData
->
nVal
+
1
));
...
...
@@ -1449,7 +1449,7 @@ static FORCE_INLINE int32_t tColDataAppendValue32(SColData *pColData, SColVal *p
return
code
;
}
#define tColDataAppendValue40 tColDataPutValue
static
FORCE_INLINE
int32_t
tColDataAppendValue41
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue41
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
pColData
->
flag
|=
HAS_NONE
;
...
...
@@ -1461,9 +1461,9 @@ static FORCE_INLINE int32_t tColDataAppendValue41(SColData *pColData, SColVal *p
memset
(
pColData
->
pBitMap
,
255
,
nBit
);
SET_BIT1
(
pColData
->
pBitMap
,
pColData
->
nVal
,
0
);
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue42
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue42
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
pColData
->
flag
|=
HAS_NULL
;
...
...
@@ -1475,9 +1475,9 @@ static FORCE_INLINE int32_t tColDataAppendValue42(SColData *pColData, SColVal *p
memset
(
pColData
->
pBitMap
,
255
,
nBit
);
SET_BIT1
(
pColData
->
pBitMap
,
pColData
->
nVal
,
0
);
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue50
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue50
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
code
=
tRealloc
(
&
pColData
->
pBitMap
,
BIT1_SIZE
(
pColData
->
nVal
+
1
));
...
...
@@ -1485,9 +1485,9 @@ static FORCE_INLINE int32_t tColDataAppendValue50(SColData *pColData, SColVal *p
SET_BIT1
(
pColData
->
pBitMap
,
pColData
->
nVal
,
1
);
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue51
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue51
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
code
=
tRealloc
(
&
pColData
->
pBitMap
,
BIT1_SIZE
(
pColData
->
nVal
+
1
));
...
...
@@ -1495,9 +1495,9 @@ static FORCE_INLINE int32_t tColDataAppendValue51(SColData *pColData, SColVal *p
SET_BIT1
(
pColData
->
pBitMap
,
pColData
->
nVal
,
0
);
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue52
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue52
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
pColData
->
flag
|=
HAS_NULL
;
...
...
@@ -1514,18 +1514,18 @@ static FORCE_INLINE int32_t tColDataAppendValue52(SColData *pColData, SColVal *p
tFree
(
pColData
->
pBitMap
);
pColData
->
pBitMap
=
pBitMap
;
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue60
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue60
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
code
=
tRealloc
(
&
pColData
->
pBitMap
,
BIT1_SIZE
(
pColData
->
nVal
+
1
));
if
(
code
)
return
code
;
SET_BIT1
(
pColData
->
pBitMap
,
pColData
->
nVal
,
1
);
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue61
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue61
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
pColData
->
flag
|=
HAS_NONE
;
...
...
@@ -1542,45 +1542,45 @@ static FORCE_INLINE int32_t tColDataAppendValue61(SColData *pColData, SColVal *p
tFree
(
pColData
->
pBitMap
);
pColData
->
pBitMap
=
pBitMap
;
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue62
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue62
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
code
=
tRealloc
(
&
pColData
->
pBitMap
,
BIT1_SIZE
(
pColData
->
nVal
+
1
));
if
(
code
)
return
code
;
SET_BIT1
(
pColData
->
pBitMap
,
pColData
->
nVal
,
0
);
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue70
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue70
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
code
=
tRealloc
(
&
pColData
->
pBitMap
,
BIT2_SIZE
(
pColData
->
nVal
+
1
));
if
(
code
)
return
code
;
SET_BIT2
(
pColData
->
pBitMap
,
pColData
->
nVal
,
2
);
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue71
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue71
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
code
=
tRealloc
(
&
pColData
->
pBitMap
,
BIT2_SIZE
(
pColData
->
nVal
+
1
));
if
(
code
)
return
code
;
SET_BIT2
(
pColData
->
pBitMap
,
pColData
->
nVal
,
0
);
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
FORCE_INLINE
int32_t
tColDataAppendValue72
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
static
FORCE_INLINE
int32_t
tColDataAppendValue72
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
code
=
tRealloc
(
&
pColData
->
pBitMap
,
BIT2_SIZE
(
pColData
->
nVal
+
1
));
if
(
code
)
return
code
;
SET_BIT2
(
pColData
->
pBitMap
,
pColData
->
nVal
,
1
);
return
tColDataPutValue
(
pColData
,
p
ColVal
);
return
tColDataPutValue
(
pColData
,
p
Data
,
nData
);
}
static
int32_t
(
*
tColDataAppendValueImpl
[
8
][
3
])(
SColData
*
pColData
,
SColVal
*
pColVal
)
=
{
static
int32_t
(
*
tColDataAppendValueImpl
[
8
][
3
])(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
)
=
{
{
tColDataAppendValue00
,
tColDataAppendValue01
,
tColDataAppendValue02
},
// 0
{
tColDataAppendValue10
,
tColDataAppendValue11
,
tColDataAppendValue12
},
// HAS_NONE
{
tColDataAppendValue20
,
tColDataAppendValue21
,
tColDataAppendValue22
},
// HAS_NULL
...
...
@@ -1592,7 +1592,9 @@ static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, SColVal *pCo
};
int32_t
tColDataAppendValue
(
SColData
*
pColData
,
SColVal
*
pColVal
)
{
ASSERT
(
pColData
->
cid
==
pColVal
->
cid
&&
pColData
->
type
==
pColVal
->
type
);
return
tColDataAppendValueImpl
[
pColData
->
flag
][
pColVal
->
flag
](
pColData
,
pColVal
);
return
tColDataAppendValueImpl
[
pColData
->
flag
][
pColVal
->
flag
](
pColData
,
IS_VAR_DATA_TYPE
(
pColData
->
type
)
?
pColVal
->
value
.
pData
:
(
uint8_t
*
)
&
pColVal
->
value
.
val
,
pColVal
->
value
.
nData
);
}
static
FORCE_INLINE
void
tColDataGetValue1
(
SColData
*
pColData
,
int32_t
iVal
,
SColVal
*
pColVal
)
{
// HAS_NONE
...
...
@@ -1772,19 +1774,17 @@ int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind) {
}
pColData
->
nVal
+=
pBind
->
num
;
if
(
IS_VAR_DATA_TYPE
(
pBind
->
buffer_type
))
{
// var
if
(
IS_VAR_DATA_TYPE
(
pBind
->
buffer_type
))
{
// var-length data type
for
(
int32_t
i
=
0
;
i
<
pBind
->
num
;
++
i
)
{
if
(
pBind
->
is_null
[
i
])
{
// tColDataAppendNull(pColData);
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NULL
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
}
else
{
uint8_t
*
pData
=
(
uint8_t
*
)
pBind
->
buffer
+
pBind
->
buffer_length
*
i
;
SValue
value
=
{.
nData
=
pBind
->
length
[
i
],
.
pData
=
pData
};
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_VALUE
](
pColData
,
(
uint8_t
*
)
pBind
->
buffer
+
pBind
->
buffer_length
*
i
,
pBind
->
length
[
i
]);
}
}
}
else
{
// fix
}
else
{
// fixed-length data type
pColData
->
nVal
+=
pBind
->
num
;
if
(
allValue
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录