fix(stream): handle const boundary in external window range#34669
fix(stream): handle const boundary in external window range#34669JinqingKuang wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request aims to fix an issue in stream processing by correctly handling constant boundaries in external window ranges, specifically within sclCalcStreamExtWinsTimeRange. However, the implementation introduces a vulnerability to signed integer overflows when processing boundary values near INT64_MAX. These overflows can lead to incorrect window ranges, potentially causing logic bypasses or incorrect data processing in streams. It is recommended to use overflow-safe arithmetic or add explicit checks for boundary conditions. Additionally, there are opportunities to refactor parts of the new logic to reduce code duplication and improve maintainability.
There was a problem hiding this comment.
Pull request overview
This PR fixes a stream execution bug triggered by external window time-range calculation when a filter uses a constant timestamp boundary together with stream window placeholders (e.g., _twstart), and adds CI coverage to prevent regressions.
Changes:
- Update external window range calculation to correctly handle constant (VALUE node) timestamp boundaries and broadcast single-row timestamp results across all external windows.
- Add a new stream regression test covering
ts >= <const>combined withts < _twstart. - Register the new test in the CI task list.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/ci/cases.task | Adds the new trigger-mode stream regression test to CI execution. |
| test/cases/18-StreamProcessing/03-TriggerMode/test_interval_const_filter_twstart.py | New regression test reproducing the const-boundary + _twstart filter scenario and asserting stream tasks don’t fail. |
| source/libs/scalar/src/scalar.c | Fixes external window time range calculation to support constant timestamp boundaries and align row counts with external window count. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e3672b3 to
f800ce8
Compare
f800ce8 to
a01a09f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/cases/18-StreamProcessing/03-TriggerMode/test_interval_const_filter_twstart.py
Show resolved
Hide resolved
a01a09f to
eaa9453
Compare
Code reviewFound 3 issues:
TDengine/source/libs/executor/src/externalwindowoperator.c Lines 1788 to 1790 in eaa9453
TDengine/source/libs/scalar/src/scalar.c Lines 1333 to 1363 in eaa9453
TDengine/source/libs/executor/src/externalwindowoperator.c Lines 1788 to 1790 in eaa9453 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
eaa9453 to
aa8ef32
Compare
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
fix(stream): handle const boundary in external window range
Issue(s)
Checklist
Please check the items in the checklist if applicable.