Skip to content

feat: [6598098782] Support indefrows funcs in window query.#35140

Open
Simon9997 wants to merge 4 commits into3.0from
feat/3.0/6598098782
Open

feat: [6598098782] Support indefrows funcs in window query.#35140
Simon9997 wants to merge 4 commits into3.0from
feat/3.0/6598098782

Conversation

@Simon9997
Copy link
Copy Markdown
Contributor

Description

Issue(s)

  • Close/close/Fix/fix/Resolve/resolve: Issue Link

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Copilot AI review requested due to automatic review settings April 15, 2026 00:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SIndefRowsRuntime path 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.

Comment thread source/libs/executor/src/executorInt.c Outdated
Comment thread source/libs/executor/src/timewindowoperator.c
Comment thread source/libs/executor/src/timewindowoperator.c
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread source/libs/executor/src/executorInt.c
@Simon9997 Simon9997 force-pushed the feat/3.0/6598098782 branch from 8b0bb18 to ab30519 Compare April 15, 2026 00:52
Copilot AI review requested due to automatic review settings April 16, 2026 07:18
@Simon9997 Simon9997 force-pushed the feat/3.0/6598098782 branch from ab30519 to e956367 Compare April 16, 2026 07:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread source/libs/parser/src/parTranslater.c
@Simon9997 Simon9997 force-pushed the feat/3.0/6598098782 branch from e956367 to f508210 Compare April 16, 2026 08:34
…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>
Copilot AI review requested due to automatic review settings April 16, 2026 10:10
@Simon9997 Simon9997 force-pushed the feat/3.0/6598098782 branch from f508210 to 5972c20 Compare April 16, 2026 10:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread test/cases/11-Functions/04-Timeseries/test_fun_ts_with_window.py
Comment thread docs/en/05-basic/03-query.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants