Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
b0b119
TDengine
提交
01780f4a
TDengine
项目概览
b0b119
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
01780f4a
编写于
4月 26, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-166
上级
7fafd24e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
18 deletion
+21
-18
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+2
-2
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+1
-1
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+11
-11
src/tsdb/tests/tsdbTests.cpp
src/tsdb/tests/tsdbTests.cpp
+3
-2
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+4
-2
未找到文件。
src/client/src/tscUtil.c
浏览文件 @
01780f4a
...
...
@@ -664,8 +664,8 @@ static void trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock) {
*
(
int32_t
*
)
pDataBlock
=
total
;
pDataBlock
+=
sizeof
(
int32_t
);
*
(
int32_t
*
)
pDataBlock
=
firstPartLen
;
pDataBlock
+=
sizeof
(
int32_t
);
//
*(int32_t*) pDataBlock = firstPartLen;
//
pDataBlock += sizeof(int32_t);
memcpy
(
pDataBlock
,
p
,
pTableDataBlock
->
rowSize
);
...
...
src/common/inc/tdataformat.h
浏览文件 @
01780f4a
...
...
@@ -92,7 +92,7 @@ typedef void *SDataRow;
SDataRow
tdNewDataRowFromSchema
(
STSchema
*
pSchema
);
void
tdFreeDataRow
(
SDataRow
row
);
void
tdInitDataRow
(
SDataRow
row
,
STSchema
*
pSchema
);
int
tdAppendColVal
(
SDataRow
row
,
void
*
value
,
STSchema
*
pSchema
,
int
col
);
int
tdAppendColVal
(
SDataRow
row
,
void
*
value
,
int8_t
type
,
int32_t
bytes
,
int32_t
offset
);
void
tdDataRowReset
(
SDataRow
row
,
STSchema
*
pSchema
);
SDataRow
tdDataRowDup
(
SDataRow
row
);
...
...
src/common/src/tdataformat.c
浏览文件 @
01780f4a
...
...
@@ -160,22 +160,22 @@ void tdFreeDataRow(SDataRow row) {
/**
* Append a column value to the data row
* @param type: column type
* @param bytes: column bytes
* @param offset: offset in the data row tuple, not including the data row header
*/
int
tdAppendColVal
(
SDataRow
row
,
void
*
value
,
STSchema
*
pSchema
,
int
col
)
{
ASSERT
(
schemaNCols
(
pSchema
)
>
col
);
STColumn
*
pCol
=
schemaColAt
(
pSchema
,
col
);
int32_t
toffset
=
pCol
->
offset
+
TD_DATA_ROW_HEAD_SIZE
;
char
*
ptr
=
dataRowAt
(
row
,
dataRowLen
(
row
));
int
tdAppendColVal
(
SDataRow
row
,
void
*
value
,
int8_t
type
,
int32_t
bytes
,
int32_t
offset
)
{
int32_t
toffset
=
offset
+
TD_DATA_ROW_HEAD_SIZE
;
char
*
ptr
=
dataRowAt
(
row
,
dataRowLen
(
row
));
switch
(
colType
(
pCol
)
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
if
(
value
==
NULL
)
{
*
(
int32_t
*
)
dataRowAt
(
row
,
toffset
)
=
-
1
;
}
else
{
int16_t
slen
=
(
colType
(
pCol
)
==
TSDB_DATA_TYPE_BINARY
)
?
strlen
((
char
*
)
value
)
:
wcslen
((
wchar_t
*
)
value
)
*
TSDB_NCHAR_SIZE
;
if
(
slen
>
colBytes
(
pCol
))
return
-
1
;
int16_t
slen
=
(
type
)
?
strlen
((
char
*
)
value
)
:
wcslen
((
wchar_t
*
)
value
)
*
TSDB_NCHAR_SIZE
;
if
(
slen
>
bytes
)
return
-
1
;
*
(
int32_t
*
)
dataRowAt
(
row
,
toffset
)
=
dataRowLen
(
row
);
*
(
int16_t
*
)
ptr
=
slen
;
...
...
@@ -186,9 +186,9 @@ int tdAppendColVal(SDataRow row, void *value, STSchema *pSchema, int col) {
break
;
default:
if
(
value
==
NULL
)
{
setNull
(
dataRowAt
(
row
,
toffset
),
colType
(
pCol
),
colBytes
(
pCol
)
);
setNull
(
dataRowAt
(
row
,
toffset
),
type
,
bytes
);
}
else
{
memcpy
(
dataRowAt
(
row
,
toffset
),
value
,
TYPE_BYTES
[
colType
(
pCol
)
]);
memcpy
(
dataRowAt
(
row
,
toffset
),
value
,
TYPE_BYTES
[
type
]);
}
break
;
}
...
...
src/tsdb/tests/tsdbTests.cpp
浏览文件 @
01780f4a
...
...
@@ -52,11 +52,12 @@ static int insertData(SInsertInfo *pInfo) {
tdInitDataRow
(
row
,
pInfo
->
pSchema
);
for
(
int
j
=
0
;
j
<
schemaNCols
(
pInfo
->
pSchema
);
j
++
)
{
STColumn
*
pTCol
=
schemaColAt
(
pInfo
->
pSchema
,
j
);
if
(
j
==
0
)
{
// Just for timestamp
tdAppendColVal
(
row
,
(
void
*
)(
&
start_time
),
p
Info
->
pSchema
,
j
);
tdAppendColVal
(
row
,
(
void
*
)(
&
start_time
),
p
TCol
->
type
,
pTCol
->
bytes
,
pTCol
->
offset
);
}
else
{
// For int
int
val
=
10
;
tdAppendColVal
(
row
,
(
void
*
)(
&
val
),
p
Info
->
pSchema
,
j
);
tdAppendColVal
(
row
,
(
void
*
)(
&
val
),
p
TCol
->
type
,
pTCol
->
bytes
,
pTCol
->
offset
);
}
}
pBlock
->
len
+=
dataRowLen
(
row
);
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
01780f4a
...
...
@@ -141,7 +141,8 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
SDataRow
dataRow
=
tdNewDataRowFromSchema
(
pDestTagSchema
);
for
(
int
i
=
0
;
i
<
numOfTags
;
i
++
)
{
tdAppendColVal
(
dataRow
,
pTagData
+
accumBytes
,
pDestTagSchema
,
i
);
STColumn
*
pTCol
=
schemaColAt
(
pDestSchema
,
i
);
tdAppendColVal
(
dataRow
,
pTagData
+
accumBytes
,
pTCol
->
type
,
pTCol
->
bytes
,
pTCol
->
offset
);
accumBytes
+=
htons
(
pSchema
[
i
+
numOfColumns
].
bytes
);
}
tsdbTableSetTagValue
(
&
tCfg
,
dataRow
,
false
);
...
...
@@ -204,7 +205,8 @@ static int32_t vnodeProcessAlterTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet
SDataRow
dataRow
=
tdNewDataRowFromSchema
(
pDestTagSchema
);
for
(
int
i
=
0
;
i
<
numOfTags
;
i
++
)
{
tdAppendColVal
(
dataRow
,
pTagData
+
accumBytes
,
pDestTagSchema
,
i
);
STColumn
*
pTCol
=
schemaColAt
(
pDestTagSchema
,
i
);
tdAppendColVal
(
dataRow
,
pTagData
+
accumBytes
,
pTCol
->
type
,
pTCol
->
bytes
,
pTCol
->
offset
);
accumBytes
+=
htons
(
pSchema
[
i
+
numOfColumns
].
bytes
);
}
tsdbTableSetTagValue
(
&
tCfg
,
dataRow
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录