Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4f15fc19
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,发现更多精彩内容 >>
未验证
提交
4f15fc19
编写于
8月 12, 2022
作者:
X
Xiaoyu Wang
提交者:
GitHub
8月 12, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16042 from taosdata/feature/3.0_wxy
enh: create stream options adjust
上级
e1a8d7a5
e6593b86
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
386 addition
and
384 deletion
+386
-384
include/common/tmsg.h
include/common/tmsg.h
+4
-3
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+1
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-1
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+1
-0
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+370
-370
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+4
-4
tests/script/tsim/stream/ignoreExpiredData.sim
tests/script/tsim/stream/ignoreExpiredData.sim
+5
-5
未找到文件。
include/common/tmsg.h
浏览文件 @
4f15fc19
...
...
@@ -1678,9 +1678,10 @@ typedef struct {
int32_t
code
;
}
STaskDropRsp
;
#define STREAM_TRIGGER_AT_ONCE 1
#define STREAM_TRIGGER_WINDOW_CLOSE 2
#define STREAM_TRIGGER_MAX_DELAY 3
#define STREAM_TRIGGER_AT_ONCE 1
#define STREAM_TRIGGER_WINDOW_CLOSE 2
#define STREAM_TRIGGER_MAX_DELAY 3
#define STREAM_DEFAULT_IGNORE_EXPIRED 0
typedef
struct
{
char
name
[
TSDB_STREAM_FNAME_LEN
];
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
4f15fc19
...
...
@@ -359,7 +359,7 @@ typedef struct SStreamOptions {
int8_t
triggerType
;
SNode
*
pDelay
;
SNode
*
pWatermark
;
bool
ignoreExpired
;
int8_t
ignoreExpired
;
}
SStreamOptions
;
typedef
struct
SCreateStreamStmt
{
...
...
source/libs/parser/inc/sql.y
浏览文件 @
4f15fc19
...
...
@@ -506,7 +506,7 @@ stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE.
stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; }
stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)B)->pDelay = releaseRawExprNode(pCxt, C); A = B; }
stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; }
stream_options(A) ::= stream_options(B) IGNORE EXPIRED
. { ((SStreamOptions*)B)->ignoreExpired = true
; A = B; }
stream_options(A) ::= stream_options(B) IGNORE EXPIRED
NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreExpired = taosStr2Int8(C.z, NULL, 10)
; A = B; }
/************************************************ kill connection/query ***********************************************/
cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
4f15fc19
...
...
@@ -1628,6 +1628,7 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) {
SStreamOptions
*
pOptions
=
(
SStreamOptions
*
)
nodesMakeNode
(
QUERY_NODE_STREAM_OPTIONS
);
CHECK_OUT_OF_MEM
(
pOptions
);
pOptions
->
triggerType
=
STREAM_TRIGGER_AT_ONCE
;
pOptions
->
ignoreExpired
=
STREAM_DEFAULT_IGNORE_EXPIRED
;
return
(
SNode
*
)
pOptions
;
}
...
...
source/libs/parser/src/sql.c
浏览文件 @
4f15fc19
此差异已折叠。
点击以展开。
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
4f15fc19
...
...
@@ -571,7 +571,7 @@ TEST_F(ParserInitialCTest, createStream) {
auto
setCreateStreamReqFunc
=
[
&
](
const
char
*
pStream
,
const
char
*
pSrcDb
,
const
char
*
pSql
,
const
char
*
pDstStb
=
nullptr
,
int8_t
igExists
=
0
,
int8_t
triggerType
=
STREAM_TRIGGER_AT_ONCE
,
int64_t
maxDelay
=
0
,
int64_t
watermark
=
0
,
int8_t
igExpired
=
0
)
{
int64_t
watermark
=
0
,
int8_t
igExpired
=
STREAM_DEFAULT_IGNORE_EXPIRED
)
{
snprintf
(
expect
.
name
,
sizeof
(
expect
.
name
),
"0.%s"
,
pStream
);
snprintf
(
expect
.
sourceDB
,
sizeof
(
expect
.
sourceDB
),
"0.%s"
,
pSrcDb
);
if
(
NULL
!=
pDstStb
)
{
...
...
@@ -617,11 +617,11 @@ TEST_F(ParserInitialCTest, createStream) {
clearCreateStreamReq
();
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired into st1 "
"create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired
0
into st1 "
"as select count(*) from t1 interval(10s)"
,
"st1"
,
1
,
STREAM_TRIGGER_MAX_DELAY
,
20
*
MILLISECOND_PER_SECOND
,
10
*
MILLISECOND_PER_SECOND
,
1
);
run
(
"CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED INTO st1 AS SELECT COUNT(*) "
0
);
run
(
"CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED
0
INTO st1 AS SELECT COUNT(*) "
"FROM t1 INTERVAL(10S)"
);
clearCreateStreamReq
();
}
...
...
tests/script/tsim/stream/ignoreExpiredData.sim
浏览文件 @
4f15fc19
...
...
@@ -45,9 +45,9 @@ print $data00 $data01 $data02
sql use test
sql create table t1(ts timestamp, a int, b int , c int, d double);
sql create stream streams1 trigger at_once IGNORE EXPIRED into streamt1 as select _wstart, count(*) c1, sum(a) c3 from t1 interval(10s);
sql create stream streams2 trigger at_once IGNORE EXPIRED into streamt2 as select _wstart, count(*) c1, sum(a) c3 from t1 session(ts,10s);
sql create stream streams3 trigger at_once IGNORE EXPIRED into streamt3 as select _wstart, count(*) c1, sum(a) c3 from t1 state_window(a);
sql create stream streams1 trigger at_once IGNORE EXPIRED
1
into streamt1 as select _wstart, count(*) c1, sum(a) c3 from t1 interval(10s);
sql create stream streams2 trigger at_once IGNORE EXPIRED
1
into streamt2 as select _wstart, count(*) c1, sum(a) c3 from t1 session(ts,10s);
sql create stream streams3 trigger at_once IGNORE EXPIRED
1
into streamt3 as select _wstart, count(*) c1, sum(a) c3 from t1 state_window(a);
sql insert into t1 values(1648791213000,1,2,3,1.0);
sql insert into t1 values(1648791223001,1,2,3,1.1);
sql insert into t1 values(1648791233002,2,2,3,2.1);
...
...
@@ -111,8 +111,8 @@ sql use test1
sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,1,1);
sql create table ts2 using st tags(2,2,2);
sql create stream stream_t1 trigger at_once IGNORE EXPIRED into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ;
sql create stream stream_t2 trigger at_once IGNORE EXPIRED into streamtST2 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st session(ts, 10s) ;
sql create stream stream_t1 trigger at_once IGNORE EXPIRED
1
into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ;
sql create stream stream_t2 trigger at_once IGNORE EXPIRED
1
into streamtST2 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st session(ts, 10s) ;
sql insert into ts1 values(1648791211000,1,2,3);
sql insert into ts1 values(1648791222001,2,2,3);
sql insert into ts2 values(1648791211000,1,2,3);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录