Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d7e96770
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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,发现更多精彩内容 >>
提交
d7e96770
编写于
3月 15, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10] pass tag values
上级
5085e458
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
8 deletion
+23
-8
src/dnode/src/dnodeWrite.c
src/dnode/src/dnodeWrite.c
+19
-6
src/mnode/src/mgmtNormalTable.c
src/mnode/src/mgmtNormalTable.c
+2
-1
src/mnode/src/mgmtSuperTable.c
src/mnode/src/mgmtSuperTable.c
+2
-1
未找到文件。
src/dnode/src/dnodeWrite.c
浏览文件 @
d7e96770
...
@@ -322,25 +322,38 @@ static void dnodeProcessCreateTableMsg(SWriteMsg *pMsg) {
...
@@ -322,25 +322,38 @@ static void dnodeProcessCreateTableMsg(SWriteMsg *pMsg) {
pTable
->
createdTime
=
htobe64
(
pTable
->
createdTime
);
pTable
->
createdTime
=
htobe64
(
pTable
->
createdTime
);
SSchema
*
pSchema
=
(
SSchema
*
)
pTable
->
data
;
SSchema
*
pSchema
=
(
SSchema
*
)
pTable
->
data
;
int
totalCols
=
pTable
->
numOfColumns
+
pTable
->
numOfTags
;
for
(
int
i
=
0
;
i
<
totalCols
;
i
++
)
{
pSchema
[
i
].
colId
=
htons
(
pSchema
[
i
].
colId
);
pSchema
[
i
].
bytes
=
htons
(
pSchema
[
i
].
bytes
);
}
STableCfg
tCfg
;
STableCfg
tCfg
;
tsdbInitTableCfg
(
&
tCfg
,
pTable
->
tableType
,
pTable
->
uid
,
pTable
->
sid
);
tsdbInitTableCfg
(
&
tCfg
,
pTable
->
tableType
,
pTable
->
uid
,
pTable
->
sid
);
STSchema
*
pDestSchema
=
tdNewSchema
(
pTable
->
numOfColumns
);
STSchema
*
pDestSchema
=
tdNewSchema
(
pTable
->
numOfColumns
);
for
(
int
i
=
0
;
i
<
pTable
->
numOfColumns
;
i
++
)
{
for
(
int
i
=
0
;
i
<
pTable
->
numOfColumns
;
i
++
)
{
tdSchemaAppendCol
(
pDestSchema
,
pSchema
[
i
].
type
,
htons
(
pSchema
[
i
].
colId
),
htons
(
pSchema
[
i
].
bytes
)
);
tdSchemaAppendCol
(
pDestSchema
,
pSchema
[
i
].
type
,
pSchema
[
i
].
colId
,
pSchema
[
i
].
bytes
);
}
}
tsdbTableSetSchema
(
&
tCfg
,
pDestSchema
,
false
);
tsdbTableSetSchema
(
&
tCfg
,
pDestSchema
,
false
);
if
(
pTable
->
numOfTags
!=
NULL
)
{
if
(
pTable
->
numOfTags
!=
0
)
{
STSchema
*
pDestTagSchema
=
tdNewSchema
(
pTable
->
numOfTags
);
STSchema
*
pDestTagSchema
=
tdNewSchema
(
pTable
->
numOfTags
);
for
(
int
i
=
pTable
->
numOfColumns
;
i
<
pTable
->
numOfColumns
+
pTable
->
numOfTag
s
;
i
++
)
{
for
(
int
i
=
pTable
->
numOfColumns
;
i
<
totalCol
s
;
i
++
)
{
tdSchemaAppendCol
(
pDestTagSchema
,
pSchema
[
i
].
type
,
htons
(
pSchema
[
i
].
colId
),
htons
(
pSchema
[
i
].
bytes
)
);
tdSchemaAppendCol
(
pDestTagSchema
,
pSchema
[
i
].
type
,
pSchema
[
i
].
colId
,
pSchema
[
i
].
bytes
);
}
}
tsdbTableSetSchema
(
&
tCfg
,
pDestTagSchema
,
false
);
tsdbTableSetSchema
(
&
tCfg
,
pDestTagSchema
,
false
);
}
if
(
pTable
->
tableType
==
TSDB_CHILD_TABLE
)
{
// TODO: add data row
// TODO: add data row
char
*
pTagData
=
pTable
->
data
+
totalCols
*
sizeof
(
SSchema
);
int
accumBytes
=
0
;
SDataRow
dataRow
=
tdNewDataRowFromSchema
(
pDestTagSchema
);
for
(
int
i
=
0
;
i
<
pTable
->
numOfTags
;
i
++
)
{
tdAppendColVal
(
dataRow
,
pTagData
+
accumBytes
,
pDestTagSchema
->
columns
+
i
);
accumBytes
+=
pSchema
[
i
+
pTable
->
numOfColumns
].
bytes
;
}
tsdbTableSetTagValue
(
&
tCfg
,
dataRow
,
false
);
}
}
rpcRsp
.
code
=
tsdbCreateTable
(
pTsdb
,
&
tCfg
);
rpcRsp
.
code
=
tsdbCreateTable
(
pTsdb
,
&
tCfg
);
...
...
src/mnode/src/mgmtNormalTable.c
浏览文件 @
d7e96770
...
@@ -358,8 +358,9 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
...
@@ -358,8 +358,9 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
pTable
->
nextColId
=
0
;
pTable
->
nextColId
=
0
;
for
(
int32_t
col
=
0
;
col
<
pCreate
->
numOfColumns
;
col
++
)
{
for
(
int32_t
col
=
0
;
col
<
pCreate
->
numOfColumns
;
col
++
)
{
SSchema
*
tschema
=
(
SSchema
*
)
pTable
->
schema
;
SSchema
*
tschema
=
pTable
->
schema
;
tschema
[
col
].
colId
=
pTable
->
nextColId
++
;
tschema
[
col
].
colId
=
pTable
->
nextColId
++
;
tschema
[
col
].
bytes
=
pTable
->
schema
[
col
].
bytes
;
}
}
pTable
->
sqlLen
=
pCreate
->
sqlLen
;
pTable
->
sqlLen
=
pCreate
->
sqlLen
;
...
...
src/mnode/src/mgmtSuperTable.c
浏览文件 @
d7e96770
...
@@ -235,9 +235,10 @@ int32_t mgmtCreateSuperTable(SDbObj *pDb, SCMCreateTableMsg *pCreate) {
...
@@ -235,9 +235,10 @@ int32_t mgmtCreateSuperTable(SDbObj *pDb, SCMCreateTableMsg *pCreate) {
memcpy
(
pStable
->
schema
,
pCreate
->
schema
,
numOfCols
*
sizeof
(
SSchema
));
memcpy
(
pStable
->
schema
,
pCreate
->
schema
,
numOfCols
*
sizeof
(
SSchema
));
pStable
->
nextColId
=
0
;
pStable
->
nextColId
=
0
;
for
(
int32_t
col
=
0
;
col
<
pStable
->
numOfColumn
s
;
col
++
)
{
for
(
int32_t
col
=
0
;
col
<
numOfCol
s
;
col
++
)
{
SSchema
*
tschema
=
pStable
->
schema
;
SSchema
*
tschema
=
pStable
->
schema
;
tschema
[
col
].
colId
=
pStable
->
nextColId
++
;
tschema
[
col
].
colId
=
pStable
->
nextColId
++
;
tschema
[
col
].
bytes
=
htons
(
tschema
[
col
].
bytes
);
}
}
if
(
sdbInsertRow
(
tsSuperTableSdb
,
pStable
,
0
)
<
0
)
{
if
(
sdbInsertRow
(
tsSuperTableSdb
,
pStable
,
0
)
<
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录