-
Notifications
You must be signed in to change notification settings - Fork 5k
fix(stream): handle const boundary in external window range #34669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JinqingKuang
wants to merge
1
commit into
main
Choose a base branch
from
fix/stream-const-twstart-filter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
test/cases/18-StreamProcessing/03-TriggerMode/test_interval_const_filter_twstart.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import time | ||
JinqingKuang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| from new_test_framework.utils import tdLog, tdSql, tdStream | ||
|
|
||
|
|
||
| class TestStreamIntervalConstFilterTwstart: | ||
|
|
||
| def setup_class(cls): | ||
| tdLog.debug(f"start to execute {__file__}") | ||
|
|
||
| def test_stream_interval_const_filter_twstart(self): | ||
| """Trigger mode sliding: const lower-bound with _twstart | ||
|
|
||
| Reproduce bug where stream runtime fails when the query filter mixes: | ||
| - constant timestamp lower-bound | ||
| - window placeholder upper-bound (_twstart) | ||
|
|
||
| Catalog: | ||
| - Streams:03-TriggerMode | ||
|
|
||
| Since: v3.4.0.9 | ||
|
|
||
| Labels: common,ci | ||
|
|
||
| Feishu: https://project.feishu.cn/taosdata_td/defect/detail/6766024000 | ||
|
|
||
| History: | ||
| - 2026-03-03 Jinqing Kuang Created | ||
|
|
||
| """ | ||
| tdStream.dropAllStreamsAndDbs() | ||
| tdStream.createSnode() | ||
|
|
||
| tdSql.prepare(dbname="sdb_const_twstart", vgroups=1) | ||
| tdSql.execute("use sdb_const_twstart") | ||
| tdSql.execute("create stable stb (ts timestamp, c1 int) tags(gid int);") | ||
|
|
||
| tdSql.execute( | ||
| "create stream s_const_twstart interval(1s) sliding(1s) from stb into s_const_twstart_res " | ||
| "as select _twstart, _twend, _twduration, count(*) from stb " | ||
| "where ts >= '2026-01-01 00:00:00.000' and ts < _twstart;" | ||
| ) | ||
| tdStream.checkStreamStatus("s_const_twstart") | ||
|
|
||
| tdSql.execute("create table ctb_1 using stb tags (1);") | ||
| tdSql.execute( | ||
| "insert into ctb_1 values " | ||
| "('2026-01-01 00:00:00.000', 0)," | ||
| "('2026-01-01 00:00:01.000', 1)," | ||
| "('2026-01-01 00:00:02.000', 2)," | ||
| "('2026-01-01 00:00:03.000', 3)," | ||
| "('2026-01-01 00:00:04.000', 4)," | ||
| "('2026-01-01 00:00:05.000', 5);" | ||
| ) | ||
|
|
||
| tdSql.checkResultsByFunc( | ||
| sql="select * from s_const_twstart_res;", | ||
| func=lambda: tdSql.getRows() == 5 | ||
| and tdSql.compareData(0, 0, "2026-01-01 00:00:00.000") | ||
| and tdSql.compareData(0, 1, "2026-01-01 00:00:01.000") | ||
| and tdSql.compareData(0, 2, 1000) | ||
| and tdSql.compareData(0, 3, 0) | ||
| and tdSql.compareData(1, 0, "2026-01-01 00:00:01.000") | ||
| and tdSql.compareData(1, 1, "2026-01-01 00:00:02.000") | ||
| and tdSql.compareData(1, 2, 1000) | ||
| and tdSql.compareData(1, 3, 1) | ||
| and tdSql.compareData(2, 0, "2026-01-01 00:00:02.000") | ||
| and tdSql.compareData(2, 1, "2026-01-01 00:00:03.000") | ||
| and tdSql.compareData(2, 2, 1000) | ||
| and tdSql.compareData(2, 3, 2) | ||
| and tdSql.compareData(3, 0, "2026-01-01 00:00:03.000") | ||
| and tdSql.compareData(3, 1, "2026-01-01 00:00:04.000") | ||
| and tdSql.compareData(3, 2, 1000) | ||
| and tdSql.compareData(3, 3, 3) | ||
| and tdSql.compareData(4, 0, "2026-01-01 00:00:04.000") | ||
| and tdSql.compareData(4, 1, "2026-01-01 00:00:05.000") | ||
| and tdSql.compareData(4, 2, 1000) | ||
| and tdSql.compareData(4, 3, 4) | ||
| ) | ||
|
|
||
| tdSql.checkResultsByFunc( | ||
| sql=( | ||
| "select status from information_schema.ins_stream_tasks " | ||
| "where stream_name='s_const_twstart' and type='Runner';" | ||
| ), | ||
| func=lambda: tdSql.getRows() > 0 | ||
| and all(tdSql.getData(i, 0) != "Failed" for i in range(tdSql.getRows())), | ||
| ) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.