Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
08bf69e1
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,发现更多精彩内容 >>
提交
08bf69e1
编写于
11月 28, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code fix
上级
663c13b5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
73 addition
and
60 deletion
+73
-60
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+73
-60
未找到文件。
source/common/src/tdataformat.c
浏览文件 @
08bf69e1
...
@@ -220,7 +220,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SRow **ppRow) {
...
@@ -220,7 +220,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SRow **ppRow) {
pColVal
=
(
iColVal
<
nColVal
)
?
(
SColVal
*
)
taosArrayGet
(
aColVal
,
iColVal
)
:
NULL
;
pColVal
=
(
iColVal
<
nColVal
)
?
(
SColVal
*
)
taosArrayGet
(
aColVal
,
iColVal
)
:
NULL
;
iTColumn
=
1
;
iTColumn
=
1
;
pTColumn
=
pTSchema
->
columns
+
iTColumn
;
pTColumn
=
pTSchema
->
columns
+
iTColumn
;
if
(
flag
&
0xf0
)
{
// KV
if
(
flag
>>
4
)
{
// KV
SKVIdx
*
pIdx
=
(
SKVIdx
*
)
pRow
->
data
;
SKVIdx
*
pIdx
=
(
SKVIdx
*
)
pRow
->
data
;
int32_t
iIdx
=
0
;
int32_t
iIdx
=
0
;
int32_t
nv
=
0
;
int32_t
nv
=
0
;
...
@@ -385,7 +385,7 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
...
@@ -385,7 +385,7 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
return
;
return
;
}
}
if
(
pRow
->
flag
&
0xf0
)
{
// KV Row
if
(
pRow
->
flag
>>
4
)
{
// KV Row
SKVIdx
*
pIdx
=
(
SKVIdx
*
)
pRow
->
data
;
SKVIdx
*
pIdx
=
(
SKVIdx
*
)
pRow
->
data
;
uint8_t
*
pv
=
NULL
;
uint8_t
*
pv
=
NULL
;
if
(
pRow
->
flag
&
KV_FLG_LIT
)
{
if
(
pRow
->
flag
&
KV_FLG_LIT
)
{
...
@@ -441,60 +441,74 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
...
@@ -441,60 +441,74 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
*
pColVal
=
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
);
*
pColVal
=
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
);
}
else
{
// Tuple Row
}
else
{
// Tuple Row
uint8_t
*
pf
=
NULL
;
if
(
pRow
->
flag
==
HAS_VALUE
)
{
uint8_t
*
pv
=
NULL
;
pColVal
->
cid
=
pTColumn
->
colId
;
uint8_t
bv
=
ROW_BIT_VALUE
;
pColVal
->
type
=
pTColumn
->
type
;
pColVal
->
flag
=
CV_FLAG_VALUE
;
if
(
IS_VAR_DATA_TYPE
(
pTColumn
->
type
))
{
uint8_t
*
pData
=
pRow
->
data
+
pTSchema
->
flen
+
*
(
int32_t
*
)(
pRow
->
data
+
pTColumn
->
offset
);
pData
+=
tGetU32v
(
pData
,
&
pColVal
->
value
.
nData
);
if
(
pColVal
->
value
.
nData
)
{
pColVal
->
value
.
pData
=
pData
;
}
else
{
pColVal
->
value
.
pData
=
NULL
;
}
}
else
{
memcpy
(
&
pColVal
->
value
.
val
,
pRow
->
data
+
pTColumn
->
offset
,
TYPE_BYTES
[
pTColumn
->
type
]);
}
}
else
{
uint8_t
*
pf
;
uint8_t
*
pv
;
uint8_t
bv
=
ROW_BIT_VALUE
;
switch
(
pRow
->
flag
)
{
switch
(
pRow
->
flag
)
{
case
HAS_VALUE
:
case
(
HAS_NULL
|
HAS_NONE
):
pf
=
pRow
->
data
;
bv
=
GET_BIT1
(
pRow
->
data
,
iCol
-
1
);
pv
=
pf
+
pTSchema
->
flen
;
break
;
break
;
case
(
HAS_VALUE
|
HAS_NONE
):
case
(
HAS_NULL
|
HAS_NONE
):
bv
=
GET_BIT1
(
pRow
->
data
,
iCol
-
1
);
bv
=
GET_BIT1
(
pRow
->
data
,
iCol
-
1
);
if
(
bv
)
bv
++
;
break
;
pf
=
pRow
->
data
+
BIT1_SIZE
(
pTSchema
->
numOfCols
-
1
);
case
(
HAS_VALUE
|
HAS_NONE
):
pv
=
pf
+
pTSchema
->
flen
;
bv
=
GET_BIT1
(
pRow
->
data
,
iCol
-
1
);
break
;
if
(
bv
)
bv
++
;
case
(
HAS_VALUE
|
HAS_NULL
):
pf
=
pRow
->
data
+
BIT1_SIZE
(
pTSchema
->
numOfCols
-
1
);
bv
=
GET_BIT1
(
pRow
->
data
,
iCol
-
1
);
pv
=
pf
+
pTSchema
->
flen
;
bv
++
;
break
;
pf
=
pRow
->
data
+
BIT1_SIZE
(
pTSchema
->
numOfCols
-
1
);
case
(
HAS_VALUE
|
HAS_NULL
):
pv
=
pf
+
pTSchema
->
flen
;
bv
=
GET_BIT1
(
pRow
->
data
,
iCol
-
1
);
break
;
bv
++
;
case
(
HAS_VALUE
|
HAS_NULL
|
HAS_NONE
):
pf
=
pRow
->
data
+
BIT1_SIZE
(
pTSchema
->
numOfCols
-
1
);
bv
=
GET_BIT2
(
pRow
->
data
,
iCol
-
1
);
pv
=
pf
+
pTSchema
->
flen
;
pf
=
pRow
->
data
+
BIT2_SIZE
(
pTSchema
->
numOfCols
-
1
);
break
;
pv
=
pf
+
pTSchema
->
flen
;
case
(
HAS_VALUE
|
HAS_NULL
|
HAS_NONE
):
break
;
bv
=
GET_BIT2
(
pRow
->
data
,
iCol
-
1
);
default:
pf
=
pRow
->
data
+
BIT2_SIZE
(
pTSchema
->
numOfCols
-
1
);
ASSERT
(
0
);
pv
=
pf
+
pTSchema
->
flen
;
break
;
break
;
}
default:
break
;
}
if
(
bv
==
ROW_BIT_NONE
)
{
if
(
bv
==
ROW_BIT_NONE
)
{
*
pColVal
=
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
);
*
pColVal
=
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
);
return
;
return
;
}
else
if
(
bv
==
ROW_BIT_NULL
)
{
}
else
if
(
bv
==
ROW_BIT_NULL
)
{
*
pColVal
=
COL_VAL_NULL
(
pTColumn
->
colId
,
pTColumn
->
type
);
*
pColVal
=
COL_VAL_NULL
(
pTColumn
->
colId
,
pTColumn
->
type
);
return
;
return
;
}
}
pColVal
->
cid
=
pTColumn
->
colId
;
pColVal
->
cid
=
pTColumn
->
colId
;
pColVal
->
type
=
pTColumn
->
type
;
pColVal
->
type
=
pTColumn
->
type
;
pColVal
->
flag
=
CV_FLAG_VALUE
;
pColVal
->
flag
=
CV_FLAG_VALUE
;
if
(
IS_VAR_DATA_TYPE
(
pTColumn
->
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pTColumn
->
type
))
{
uint8_t
*
pData
=
pv
+
*
(
int32_t
*
)(
pf
+
pTColumn
->
offset
);
uint8_t
*
pData
=
pv
+
*
(
int32_t
*
)(
pf
+
pTColumn
->
offset
);
pData
+=
tGetU32v
(
pData
,
&
pColVal
->
value
.
nData
);
pData
+=
tGetU32v
(
pData
,
&
pColVal
->
value
.
nData
);
if
(
pColVal
->
value
.
nData
)
{
if
(
pColVal
->
value
.
nData
)
{
pColVal
->
value
.
pData
=
pData
;
pColVal
->
value
.
pData
=
pData
;
}
else
{
pColVal
->
value
.
pData
=
NULL
;
}
}
else
{
}
else
{
pColVal
->
value
.
pData
=
NULL
;
memcpy
(
&
pColVal
->
value
.
val
,
pf
+
pTColumn
->
offset
,
TYPE_BYTES
[
pTColumn
->
type
])
;
}
}
}
else
{
memcpy
(
&
pColVal
->
value
.
val
,
pv
+
pTColumn
->
offset
,
pTColumn
->
bytes
);
}
}
}
}
}
}
...
@@ -512,7 +526,7 @@ static int32_t tRowPCmprFn(const void *p1, const void *p2) {
...
@@ -512,7 +526,7 @@ static int32_t tRowPCmprFn(const void *p1, const void *p2) {
return
0
;
return
0
;
}
}
static
void
tRowPDestroy
(
SRow
**
ppRow
)
{
t
Free
((
uint8_t
*
)
*
ppRow
);
}
static
void
tRowPDestroy
(
SRow
**
ppRow
)
{
t
RowDestroy
(
*
ppRow
);
}
static
int32_t
tRowMerge
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int32_t
iStart
,
int32_t
iEnd
,
int8_t
flag
)
{
static
int32_t
tRowMerge
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int32_t
iStart
,
int32_t
iEnd
,
int8_t
flag
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -623,10 +637,9 @@ struct SRowIter {
...
@@ -623,10 +637,9 @@ struct SRowIter {
uint8_t
*
pb
;
uint8_t
*
pb
;
uint8_t
*
pf
;
uint8_t
*
pf
;
};
};
uint8_t
*
pv
;
};
};
uint8_t
*
pv
;
SColVal
cv
;
SColVal
cv
;
};
};
int32_t
tRowIterOpen
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
SRowIter
**
ppIter
)
{
int32_t
tRowIterOpen
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
SRowIter
**
ppIter
)
{
...
@@ -646,15 +659,15 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) {
...
@@ -646,15 +659,15 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) {
if
(
pRow
->
flag
==
HAS_NONE
||
pRow
->
flag
==
HAS_NULL
)
goto
_exit
;
if
(
pRow
->
flag
==
HAS_NONE
||
pRow
->
flag
==
HAS_NULL
)
goto
_exit
;
if
(
pRow
->
flag
&
0xf0
)
{
if
(
pRow
->
flag
>>
4
)
{
pIter
->
iCol
=
0
;
pIter
->
iCol
=
0
;
pIter
->
pIdx
=
(
SKVIdx
*
)
pRow
->
data
;
pIter
->
pIdx
=
(
SKVIdx
*
)
pRow
->
data
;
if
(
pRow
->
flag
&
KV_FLG_LIT
)
{
if
(
pRow
->
flag
&
KV_FLG_LIT
)
{
pIter
->
pv
=
pIter
->
pIdx
->
idx
+
pIter
->
pIdx
->
nCol
;
pIter
->
pv
=
pIter
->
pIdx
->
idx
+
pIter
->
pIdx
->
nCol
;
}
else
if
(
pRow
->
flag
&
KV_FLG_MID
)
{
}
else
if
(
pRow
->
flag
&
KV_FLG_MID
)
{
pIter
->
pv
=
pIter
->
pIdx
->
idx
+
(
pIter
->
pIdx
->
nCol
<<
1
);
pIter
->
pv
=
pIter
->
pIdx
->
idx
+
(
pIter
->
pIdx
->
nCol
<<
1
);
// * sizeof(uint16_t)
}
else
{
}
else
{
pIter
->
pv
=
pIter
->
pIdx
->
idx
+
(
pIter
->
pIdx
->
nCol
<<
2
);
pIter
->
pv
=
pIter
->
pIdx
->
idx
+
(
pIter
->
pIdx
->
nCol
<<
2
);
// * sizeof(uint32_t)
}
}
}
else
{
}
else
{
switch
(
pRow
->
flag
)
{
switch
(
pRow
->
flag
)
{
...
@@ -726,7 +739,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
...
@@ -726,7 +739,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
goto
_exit
;
goto
_exit
;
}
}
if
(
pIter
->
pRow
->
flag
&
0xf0
)
{
// KV
if
(
pIter
->
pRow
->
flag
>>
4
)
{
// KV
if
(
pIter
->
iCol
<
pIter
->
pIdx
->
nCol
)
{
if
(
pIter
->
iCol
<
pIter
->
pIdx
->
nCol
)
{
uint8_t
*
pData
;
uint8_t
*
pData
;
...
@@ -816,7 +829,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
...
@@ -816,7 +829,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
pIter
->
cv
.
value
.
pData
=
NULL
;
pIter
->
cv
.
value
.
pData
=
NULL
;
}
}
}
else
{
}
else
{
memcpy
(
&
pIter
->
cv
.
value
.
val
,
pIter
->
p
v
+
pTColumn
->
offset
,
pTColumn
->
bytes
);
memcpy
(
&
pIter
->
cv
.
value
.
val
,
pIter
->
p
f
+
pTColumn
->
offset
,
TYPE_BYTES
[
pTColumn
->
type
]
);
}
}
goto
_exit
;
goto
_exit
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录