Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aef9dc59
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看板
提交
aef9dc59
编写于
12月 30, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: support writing streams to existing tables
上级
bc2fa582
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
16 addition
and
7 deletion
+16
-7
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+6
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+1
-1
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+9
-5
未找到文件。
source/libs/parser/src/parAstParser.c
浏览文件 @
aef9dc59
...
...
@@ -355,7 +355,12 @@ static int32_t collectMetaKeyFromDescribe(SCollectMetaKeyCxt* pCxt, SDescribeStm
}
static
int32_t
collectMetaKeyFromCreateStream
(
SCollectMetaKeyCxt
*
pCxt
,
SCreateStreamStmt
*
pStmt
)
{
return
collectMetaKeyFromQuery
(
pCxt
,
pStmt
->
pQuery
);
int32_t
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
targetDbName
,
pStmt
->
targetTabName
,
pCxt
->
pMetaCache
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
collectMetaKeyFromQuery
(
pCxt
,
pStmt
->
pQuery
);
}
return
code
;
}
static
int32_t
collectMetaKeyFromShowDnodes
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
aef9dc59
...
...
@@ -5846,10 +5846,10 @@ static int32_t adjustStreamQueryForExistTable(STranslateContext* pCxt, SCreateSt
if
(
NULL
!=
pStmt
->
pCols
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_TABLE_NOT_EXIST
,
pStmt
->
targetTabName
);
}
pReq
->
createStb
=
1
;
return
TSDB_CODE_SUCCESS
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
// todo pReq->create = true;
code
=
adjustStreamQueryForExistTableImpl
(
pCxt
,
pStmt
,
pMeta
);
}
return
code
;
...
...
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
aef9dc59
...
...
@@ -816,16 +816,16 @@ TEST_F(ParserInitialCTest, createStream) {
tFreeSCMCreateStreamReq
(
&
req
);
});
setCreateStreamReq
(
"s1"
,
"test"
,
"create stream s1 into st
1 as select count(*) from t1 interval(10s)"
,
"st1
"
);
run
(
"CREATE STREAM s1 INTO st
1
AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"
);
setCreateStreamReq
(
"s1"
,
"test"
,
"create stream s1 into st
3 as select count(*) from t1 interval(10s)"
,
"st3
"
);
run
(
"CREATE STREAM s1 INTO st
3
AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"
);
clearCreateStreamReq
();
setCreateStreamReq
(
"s1"
,
"test"
,
"create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 into st
1
"
"create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 into st
3
"
"as select count(*) from t1 interval(10s)"
,
"st
1
"
,
1
,
STREAM_TRIGGER_MAX_DELAY
,
20
*
MILLISECOND_PER_SECOND
,
10
*
MILLISECOND_PER_SECOND
,
0
,
1
);
run
(
"CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 INTO st
1
AS "
"st
3
"
,
1
,
STREAM_TRIGGER_MAX_DELAY
,
20
*
MILLISECOND_PER_SECOND
,
10
*
MILLISECOND_PER_SECOND
,
0
,
1
);
run
(
"CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 INTO st
3
AS "
"SELECT COUNT(*) "
"FROM t1 INTERVAL(10S)"
);
clearCreateStreamReq
();
...
...
@@ -839,6 +839,10 @@ TEST_F(ParserInitialCTest, createStream) {
run
(
"CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) "
"AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 PARTITION BY TBNAME tname, tag1 id INTERVAL(10S)"
);
clearCreateStreamReq
();
setCreateStreamReq
(
"s1"
,
"test"
,
"create stream s1 into st1 as select max(c1), c2 from t1 interval(10s)"
,
"st1"
);
run
(
"CREATE STREAM s1 INTO st1 AS SELECT MAX(c1), c2 FROM t1 INTERVAL(10S)"
);
clearCreateStreamReq
();
}
TEST_F
(
ParserInitialCTest
,
createStreamSemanticCheck
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录