feat: [6598098782] Support indefrows funcs in window query.#35140
feat: [6598098782] Support indefrows funcs in window query.#35140
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for “indefinite rows” (by-row/vector) time-series functions inside window queries, extending parser/planner/executor behavior and updating tests/docs accordingly.
Changes:
- Enable/validate indefinite-rows functions in window clauses (and refine related rejection rules/messages in parser/planner).
- Extend executor window operators (interval/session/state/event/count) with an
SIndefRowsRuntimepath to accumulate and return variable-row results. - Add/adjust test coverage and update error-code/docs to reflect new behavior and new internal error code.
Reviewed changes
Copilot reviewed 30 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
source/libs/parser/src/parTranslater.c |
Allows certain indefinite-rows funcs in window queries; refines error messages and adds FILL restriction. |
source/libs/planner/src/planLogicCreater.c |
Marks window nodes as indefRowsFunc and collects appropriate function set for window execution. |
source/libs/planner/src/planSpliter.c |
Prevents certain interval split optimizations when indefRowsFunc is present. |
source/libs/function/src/functionMgt.c / include/libs/function/functionMgt.h |
Adds fmIsWindowIndefRowsFunc classification helper. |
source/libs/executor/inc/executorInt.h |
Introduces SIndefRowsRuntime/state structs + APIs for indefinite-rows window execution. |
source/libs/executor/src/executorInt.c |
Implements indefinite-rows window runtime (state management, block sealing, result delivery). |
source/libs/executor/src/timewindowoperator.c |
Hooks interval window aggregation into indefinite-rows runtime path. |
source/libs/executor/src/eventwindowoperator.c |
Hooks event window aggregation into indefinite-rows runtime path and adjusts lifecycle. |
source/libs/executor/src/countwindowoperator.c |
Hooks count window aggregation into indefinite-rows runtime path and adjusts buffering/state. |
include/util/taoserror.h / source/util/src/terror.c / source/util/test/errorCodeTable.ini |
Adds new internal error code TSDB_CODE_QRY_WINDOW_STATE_NOT_EXIST. |
docs/*/14-reference/09-error-code.md |
Documents the new error code (ZH/EN). |
docs/*/03-taos-sql/* and docs/*/05-basic/03-query.md |
Updates window-clause/function docs to reflect new window support semantics. |
test/cases/... / test/ci/cases.task |
Adds new window test suite, updates existing expectations and error messages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request introduces support for time-series functions like LAG, LEAD, MAVG, and CSUM within window queries, ensuring they are evaluated locally within each window. It implements a new state management framework (SIndefRowsRuntime) and updates the executor's window operators, parser, and planner logic. The feedback highlights a need to update data block window metadata to the full logical window range before processing sealed blocks to maintain consistency for upstream components.
8b0bb18 to
ab30519
Compare
ab30519 to
e956367
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 43 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e956367 to
f508210
Compare
…ons in interval queries Allow indefRows functions (csum, diff, derivative, mavg, statecount, stateduration) to work with FILL clause in interval queries. Changes: - parser: lift restriction blocking FILL with indefRows functions - planner: propagate indefRowsMode flag through plan nodes - nodes: serialize/deserialize/clone indefRowsMode field - executor: implement multi-row window pass-through in fill engine, reset indefWindowActive on fill reset, validate fill values Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f508210 to
5972c20
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 43 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.