Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
191870b2
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看板
提交
191870b2
编写于
11月 28, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
37239ffa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
192 addition
and
25 deletion
+192
-25
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+192
-25
未找到文件。
source/common/src/tdataformat.c
浏览文件 @
191870b2
...
...
@@ -883,6 +883,193 @@ static int32_t tRowAppendNullToColData(SArray *aColData, int32_t nColData, STSch
}
}
_exit:
return
code
;
}
static
int32_t
tRowAppendTupleToColData
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
SArray
*
aColData
,
int32_t
nColData
)
{
int32_t
code
=
0
;
int32_t
iColData
=
0
;
SColData
*
pColData
=
taosArrayGet
(
aColData
,
iColData
);
int32_t
iTColumn
=
1
;
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
iTColumn
];
uint8_t
*
pb
=
NULL
;
uint8_t
*
pf
;
uint8_t
*
pv
;
switch
(
pRow
->
flag
)
{
case
HAS_VALUE
:
pf
=
pRow
->
data
;
pv
=
pf
+
pTSchema
->
flen
;
break
;
case
(
HAS_NULL
|
HAS_NONE
):
pb
=
pRow
->
data
;
break
;
case
(
HAS_VALUE
|
HAS_NONE
):
case
(
HAS_VALUE
|
HAS_NULL
):
pb
=
pRow
->
data
;
pf
=
pb
+
BIT1_SIZE
(
pTSchema
->
numOfCols
-
1
);
pv
=
pf
+
pTSchema
->
flen
;
break
;
case
(
HAS_VALUE
|
HAS_NULL
|
HAS_NONE
):
pb
=
pRow
->
data
;
pf
=
pb
+
BIT2_SIZE
(
pTSchema
->
numOfCols
-
1
);
pv
=
pf
+
pTSchema
->
flen
;
break
;
default:
ASSERT
(
0
);
break
;
}
while
(
pColData
)
{
if
(
pTColumn
)
{
if
(
pTColumn
->
colId
==
pColData
->
cid
)
{
ASSERT
(
pTColumn
->
type
==
pColData
->
type
);
if
(
pb
)
{
uint8_t
bv
;
switch
(
pRow
->
flag
)
{
case
(
HAS_NULL
|
HAS_NONE
):
bv
=
GET_BIT1
(
pb
,
iTColumn
-
1
);
break
;
case
(
HAS_VALUE
|
HAS_NONE
):
bv
=
GET_BIT1
(
pb
,
iTColumn
-
1
);
if
(
bv
)
bv
++
;
break
;
case
(
HAS_VALUE
|
HAS_NULL
):
bv
=
GET_BIT1
(
pb
,
iTColumn
-
1
)
+
1
;
break
;
case
(
HAS_VALUE
|
HAS_NULL
|
HAS_NONE
):
bv
=
GET_BIT2
(
pb
,
iTColumn
-
1
);
break
;
default:
ASSERT
(
0
);
break
;
}
if
(
bv
==
ROW_BIT_NONE
)
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NONE
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
goto
_continue
;
}
else
if
(
bv
==
ROW_BIT_NULL
)
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NULL
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
goto
_continue
;
}
}
if
(
IS_VAR_DATA_TYPE
(
pColData
->
type
))
{
uint8_t
*
pData
=
pv
+
*
(
int32_t
*
)(
pf
+
pTColumn
->
offset
);
uint32_t
nData
;
pData
+=
tGetU32v
(
pData
,
&
nData
);
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_VALUE
](
pColData
,
pData
,
nData
);
if
(
code
)
goto
_exit
;
}
else
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_VALUE
](
pColData
,
pf
+
pTColumn
->
offset
,
TYPE_BYTES
[
pColData
->
type
]);
if
(
code
)
goto
_exit
;
}
_continue:
pColData
=
(
++
iColData
<
nColData
)
?
taosArrayGet
(
aColData
,
iColData
)
:
NULL
;
pTColumn
=
(
++
iTColumn
<
pTSchema
->
numOfCols
)
?
&
pTSchema
->
columns
[
iTColumn
]
:
NULL
;
}
else
if
(
pTColumn
->
colId
>
pColData
->
cid
)
{
// NONE
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NONE
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
pColData
=
(
++
iColData
<
nColData
)
?
taosArrayGet
(
aColData
,
iColData
)
:
NULL
;
}
else
{
pTColumn
=
(
++
iTColumn
<
pTSchema
->
numOfCols
)
?
&
pTSchema
->
columns
[
iTColumn
]
:
NULL
;
}
}
else
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NONE
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
pColData
=
(
++
iColData
<
nColData
)
?
taosArrayGet
(
aColData
,
iColData
)
:
NULL
;
}
}
_exit:
return
code
;
}
static
int32_t
tRowAppendKVToColData
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
SArray
*
aColData
,
int32_t
nColData
)
{
int32_t
code
=
0
;
SKVIdx
*
pKVIdx
=
(
SKVIdx
*
)
pRow
->
data
;
uint8_t
*
pv
=
NULL
;
int32_t
iColData
=
0
;
SColData
*
pColData
=
taosArrayGet
(
aColData
,
iColData
);
int32_t
iTColumn
=
1
;
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
iTColumn
];
int32_t
iCol
=
0
;
if
(
pRow
->
flag
&
KV_FLG_LIT
)
{
pv
=
pKVIdx
->
idx
+
pKVIdx
->
nCol
;
}
else
if
(
pRow
->
flag
&
KV_FLG_MID
)
{
pv
=
pKVIdx
->
idx
+
(
pKVIdx
->
nCol
<<
1
);
}
else
if
(
pRow
->
flag
&
KV_FLG_BIG
)
{
pv
=
pKVIdx
->
idx
+
(
pKVIdx
->
nCol
<<
2
);
}
else
{
ASSERT
(
0
);
}
while
(
pColData
)
{
if
(
pTColumn
)
{
if
(
pTColumn
->
colId
==
pColData
->
cid
)
{
while
(
iCol
<
pKVIdx
->
nCol
)
{
uint8_t
*
pData
;
if
(
pRow
->
flag
&
KV_FLG_LIT
)
{
pData
=
pv
+
((
uint8_t
*
)
pKVIdx
->
idx
)[
iCol
];
}
else
if
(
pRow
->
flag
&
KV_FLG_MID
)
{
pData
=
pv
+
((
uint16_t
*
)
pKVIdx
->
idx
)[
iCol
];
}
else
if
(
pRow
->
flag
&
KV_FLG_BIG
)
{
pData
=
pv
+
((
uint32_t
*
)
pKVIdx
->
idx
)[
iCol
];
}
else
{
ASSERT
(
0
);
}
int16_t
cid
;
pData
+=
tGetI16
(
pData
,
&
cid
);
if
(
TABS
(
cid
)
==
pTColumn
->
colId
)
{
if
(
cid
<
0
)
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NULL
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
}
else
{
uint32_t
nData
;
pData
+=
tGetU32v
(
pData
,
&
nData
);
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_VALUE
](
pColData
,
pData
,
nData
);
if
(
code
)
goto
_exit
;
}
iCol
++
;
goto
_continue
;
}
else
if
(
TABS
(
cid
)
>
pTColumn
->
colId
)
{
// NONE
break
;
}
else
{
iCol
++
;
}
}
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NONE
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
_continue:
pColData
=
(
++
iColData
<
nColData
)
?
taosArrayGet
(
aColData
,
iColData
)
:
NULL
;
pTColumn
=
(
++
iTColumn
<
pTSchema
->
numOfCols
)
?
&
pTSchema
->
columns
[
iTColumn
]
:
NULL
;
}
else
if
(
pTColumn
->
colId
>
pColData
->
cid
)
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NONE
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
pColData
=
(
++
iColData
<
nColData
)
?
taosArrayGet
(
aColData
,
iColData
)
:
NULL
;
}
else
{
pTColumn
=
(
++
iTColumn
<
pTSchema
->
numOfCols
)
?
&
pTSchema
->
columns
[
iTColumn
]
:
NULL
;
}
}
else
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NONE
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
pColData
=
(
++
iColData
<
nColData
)
?
taosArrayGet
(
aColData
,
iColData
)
:
NULL
;
}
}
_exit:
return
code
;
}
...
...
@@ -901,31 +1088,11 @@ int32_t tRowAppendToColData(SRow *pRow, STSchema *pTSchema, SArray *aColData, in
}
if
(
pRow
->
flag
>>
4
)
{
// KV row
// todo
}
else
{
// Tuple row
int32_t
iColData
=
0
;
SColData
*
pColData
=
taosArrayGet
(
aColData
,
iColData
);
int32_t
iTColumn
=
1
;
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
iTColumn
];
while
(
pColData
)
{
if
(
pTColumn
)
{
if
(
pTColumn
->
colId
==
pColData
->
cid
)
{
}
else
if
(
pTColumn
->
colId
>
pColData
->
cid
)
{
// NONE
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NONE
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
pColData
=
(
++
iColData
<
nColData
)
?
taosArrayGet
(
aColData
,
iColData
)
:
NULL
;
}
else
{
pTColumn
=
(
++
iTColumn
<
pTSchema
->
numOfCols
)
?
&
pTSchema
->
columns
[
iTColumn
]
:
NULL
;
}
}
else
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NONE
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
pColData
=
(
++
iColData
<
nColData
)
?
taosArrayGet
(
aColData
,
iColData
)
:
NULL
;
}
}
code
=
tRowAppendKVToColData
(
pRow
,
pTSchema
,
aColData
,
nColData
);
if
(
code
)
goto
_exit
;
}
else
{
code
=
tRowAppendTupleToColData
(
pRow
,
pTSchema
,
aColData
,
nColData
);
if
(
code
)
goto
_exit
;
}
_exit:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录