Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7aef8881
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
未验证
提交
7aef8881
编写于
1月 18, 2023
作者:
X
Xiaoyu Wang
提交者:
GitHub
1月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19628 from taosdata/feat/3.0_stream_wxy
fix: support writing streams to existing tables
上级
dbd882ff
caf3de29
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
12 deletion
+43
-12
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+28
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+14
-11
未找到文件。
include/common/tmsg.h
浏览文件 @
7aef8881
...
...
@@ -1789,7 +1789,7 @@ typedef struct {
// 3.0.2.3
int8_t
createStb
;
uint64_t
targetStbUid
;
SArray
*
fillNullCols
;
SArray
*
fillNullCols
;
// array of SColLocation
}
SCMCreateStreamReq
;
typedef
struct
{
...
...
source/common/src/tmsg.c
浏览文件 @
7aef8881
...
...
@@ -5428,6 +5428,13 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
}
if
(
tEncodeI8
(
&
encoder
,
pReq
->
createStb
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
&
encoder
,
pReq
->
targetStbUid
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
taosArrayGetSize
(
pReq
->
fillNullCols
))
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pReq
->
fillNullCols
);
++
i
)
{
SColLocation
*
pCol
=
taosArrayGet
(
pReq
->
fillNullCols
,
i
);
if
(
tEncodeI16
(
&
encoder
,
pCol
->
slotId
)
<
0
)
return
-
1
;
if
(
tEncodeI16
(
&
encoder
,
pCol
->
colId
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pCol
->
type
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
...
...
@@ -5490,6 +5497,26 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
}
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
createStb
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
&
decoder
,
&
pReq
->
targetStbUid
)
<
0
)
return
-
1
;
int32_t
numOfFillNullCols
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
numOfFillNullCols
)
<
0
)
return
-
1
;
if
(
numOfFillNullCols
>
0
)
{
pReq
->
fillNullCols
=
taosArrayInit
(
numOfFillNullCols
,
sizeof
(
SColLocation
));
if
(
pReq
->
fillNullCols
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
numOfFillNullCols
;
++
i
)
{
SColLocation
col
=
{
0
};
if
(
tDecodeI16
(
&
decoder
,
&
col
.
slotId
)
<
0
)
return
-
1
;
if
(
tDecodeI16
(
&
decoder
,
&
col
.
colId
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
col
.
type
)
<
0
)
return
-
1
;
if
(
taosArrayPush
(
pReq
->
fillNullCols
,
&
col
)
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
}
}
tEndDecode
(
&
decoder
);
...
...
@@ -5559,6 +5586,7 @@ void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) {
taosArrayDestroy
(
pReq
->
pTags
);
taosMemoryFreeClear
(
pReq
->
sql
);
taosMemoryFreeClear
(
pReq
->
ast
);
taosArrayDestroy
(
pReq
->
fillNullCols
);
}
int32_t
tEncodeSRSmaParam
(
SEncoder
*
pCoder
,
const
SRSmaParam
*
pRSmaParam
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
7aef8881
...
...
@@ -2210,7 +2210,8 @@ static int32_t dnodeToVgroupsInfo(SArray* pDnodes, SVgroupsInfo** pVgsInfo) {
}
static
bool
sysTableFromVnode
(
const
char
*
pTable
)
{
return
((
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TABLES
))
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TAGS
))
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_COLS
)));
return
((
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TABLES
))
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TAGS
))
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_COLS
)));
}
static
bool
sysTableFromDnode
(
const
char
*
pTable
)
{
return
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_DNODE_VARIABLES
);
}
...
...
@@ -2278,8 +2279,9 @@ static int32_t setVnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName,
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
isEmptyResult
=
true
;
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_TABLES
)
&&
!
hasUserDbCond
)
||
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_COLS
))
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_TABLES
)
&&
!
hasUserDbCond
)
||
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_COLS
))
{
code
=
addMnodeToVgroupList
(
&
pCxt
->
pParseCxt
->
mgmtEpSet
,
&
pVgs
);
}
...
...
@@ -5804,18 +5806,19 @@ static int32_t setFillNullCols(SArray* pProjColPos, const STableMeta* pMeta, SCM
if
(
NULL
==
pReq
->
fillNullCols
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
int32_t
indexOfSchema
=
0
;
const
SSchema
*
pSchemas
=
getTableColumnSchema
(
pMeta
);
for
(
int32_t
i
=
0
;
i
<
numOfBoundCols
;
++
i
)
{
SProjColPos
*
pPos
=
taosArrayGet
(
pProjColPos
,
i
);
while
(
indexOfSchema
<
pMeta
->
tableInfo
.
numOfColumns
)
{
const
SSchema
*
pSchema
=
pSchemas
+
indexOfSchema
++
;
int32_t
indexOfBoundCols
=
0
;
for
(
int32_t
i
=
0
;
i
<
pMeta
->
tableInfo
.
numOfColumns
;
++
i
)
{
const
SSchema
*
pSchema
=
pSchemas
+
i
;
if
(
indexOfBoundCols
<
numOfBoundCols
)
{
SProjColPos
*
pPos
=
taosArrayGet
(
pProjColPos
,
indexOfBoundCols
);
if
(
pSchema
->
colId
==
pPos
->
colId
)
{
break
;
++
indexOfBoundCols
;
continue
;
}
SColLocation
colLoc
=
{.
colId
=
pSchema
->
colId
,
.
slotId
=
indexOfSchema
-
1
,
.
type
=
pSchema
->
type
};
taosArrayPush
(
pReq
->
fillNullCols
,
&
colLoc
);
}
SColLocation
colLoc
=
{.
colId
=
pSchema
->
colId
,
.
slotId
=
i
,
.
type
=
pSchema
->
type
};
taosArrayPush
(
pReq
->
fillNullCols
,
&
colLoc
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录