enh: [6492510964] Virtual super table window optimize for interval/session/event - #34690
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request delivers a major enhancement to virtual super table window queries by introducing specialized optimizations for Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
Enhances TDengine virtual super table “dynamic window” execution to support additional window types (interval/session/event) and improves robustness of dynamic operator parameter handling, with expanded regression/plan tests.
Changes:
- Extend planner/executor dynamic-query-control support for virtual stable interval and virtual stable TS-scan paths (new dyn qTypes, new split rules, updated explain output).
- Improve executor/operator parameter lifecycle handling for dynamic tasks (detach-style downstream fetching, broader param serialization/freeing, extra metadata carried in datablocks).
- Expand test coverage for virtual-table window optimizations (new boundary regression test, additional interval/session/event queries and plan asserts).
Reviewed changes
Copilot reviewed 39 out of 46 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/new_test_framework/utils/common.py | Updates CLI output normalization pipeline (sed patterns) for more stable golden comparisons. |
| test/ci/cases.task | Adds new virtual table boundary test to CI task list. |
| test/cases/05-VirtualTables/test_vtable_query_same_db_stb_window.py | Enables additional state-mode window query coverage in same-db vtable tests. |
| test/cases/05-VirtualTables/test_vtable_query_cross_db_stb_window.py | Enables additional state-mode window query coverage in cross-db vtable tests. |
| test/cases/05-VirtualTables/test_vtable_query_boundary.py | Adds boundary regression tests for optimized event-window behavior and TRUE_FOR semantics. |
| test/cases/05-VirtualTables/test_vtable_plan_window_optimize.py | Adds plan testcases for session/event/interval window explain validation. |
| test/cases/05-VirtualTables/in/test_vtable_meta.in | Narrows information_schema queries to the test database for deterministic output. |
| test/cases/05-VirtualTables/in/test_vstable_select_test_session.in | Adds additional session-window query variants for vtable/vstable coverage. |
| test/cases/05-VirtualTables/in/test_vstable_select_test_event.in | Adds additional event-window + TRUE_FOR query variants for vstable coverage. |
| test/cases/05-VirtualTables/in/test_vstable_select_test_count.in | Adds additional count-window query variants for vstable coverage. |
| test/cases/05-VirtualTables/in/test_vstable_plan_test_window_session.in | New explain-verbose inputs for session window optimization path(s). |
| test/cases/05-VirtualTables/in/test_vstable_plan_test_window_interval.in | New explain-verbose inputs for interval window optimization path(s). |
| test/cases/05-VirtualTables/in/test_vstable_plan_test_window_event.in | New explain-verbose inputs for event window optimization path(s). |
| test/cases/05-VirtualTables/ans/test_vtable_meta.ans | Updates expected output for DB-filtered information_schema queries. |
| test/cases/05-VirtualTables/ans/test_vstable_select_test_state_mode_1.ans | Updates expected window results after execution/optimization changes. |
| test/cases/05-VirtualTables/ans/test_vstable_plan_test_window_interval.ans | Adds expected explain output for interval window optimization path(s). |
| source/libs/planner/src/planSpliter.c | Adds split rules and dynamicOp propagation to support new vstable interval/ts-scan execution flows. |
| source/libs/planner/src/planPhysiCreater.c | Extends dyn-query-control physical node creation for new vtb/vstable qTypes. |
| source/libs/planner/src/planOptimizer.c | Broadens vstable window optimization eligibility and adds new plan rewrites for session/event/interval. |
| source/libs/nodes/src/nodesUtilFuncs.c | Ensures new dyn qTypes free their scan-related structures on node destruction. |
| source/libs/nodes/src/nodesMsgFuncs.c | Extends dyn-query-control message encoding for new vtb/vstable qTypes. |
| source/libs/nodes/src/nodesCodeFuncs.c | Extends dyn-query-control JSON encode/decode for new vtb/vstable qTypes. |
| source/libs/function/src/builtinsimpl.c | Avoids out-of-range access for empty inputs when primary key metadata is absent. |
| source/libs/executor/src/virtualtablescanoperator.c | Adjusts vtable scan merge handling and parameter-driven loading behavior. |
| source/libs/executor/src/timewindowoperator.c | Updates downstream fetching semantics for interval/session/state window operators and dynamic params. |
| source/libs/executor/src/scanoperator.c | Adds dynamic vtable/table-merge scan support and improves batch param handling/copying of scan conds. |
| source/libs/executor/src/operator.c | Adds “detach” downstream fetching helper and adjusts dynamic table-merge scan operator creation behavior. |
| source/libs/executor/src/mergeoperator.c | Improves sort-merge operator open/load error handling and dynamic downstream param propagation. |
| source/libs/executor/src/externalwindowoperator.c | Switches to detach-style downstream fetching for dynamic external window flows. |
| source/libs/executor/src/executorInt.c | Extends operator-param freeing/logging and supports additional operator types for param management. |
| source/libs/executor/src/exchangeoperator.c | Refactors/extends exchange param construction for new virtual stable scan modes (ts/interval/partition interval). |
| source/libs/executor/src/eventwindowoperator.c | Ensures result datablock carries appropriate dataLoad metadata for event windows. |
| source/libs/executor/src/dynqueryctrloperator.c | Adds new dyn qTypes execution paths (vtb ts scan, vtb interval) and related param generation. |
| source/libs/executor/src/aggregateoperator.c | Switches to detach-style downstream fetching for grouped aggregation under dynamic modes. |
| source/libs/executor/inc/operator.h | Declares new detach-style downstream fetching API. |
| source/libs/executor/inc/executorInt.h | Adds new exchange source types for new vstable scan modes. |
| source/libs/command/src/explain.c | Updates explain text for new dyn qTypes and refactors dyn-qtype formatting helper. |
| source/common/src/tdatablock.c | Propagates scanFlag/dataLoad when composing datablocks from multiple sources. |
| source/common/src/msg/tmsg.c | Extends operator-param serialization/deserialization for new operator types. |
| include/libs/nodes/querynodes.h | Adds new EDynQueryType values for vtb ts-scan and vtb interval. |
💡 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 significant optimizations for virtual super table window queries, specifically for INTERVAL, SESSION, and EVENT windows. It refactors the query plan to handle these window types more efficiently by adding new dynamic query types, exchange source types, and operator logic. The changes also include a number of important bug fixes, such as memory leak corrections, logic fixes in window boundary calculations, and ensuring proper propagation of flags like dynamicOp. The code is also improved by consistently using taosMemoryCalloc for zero-initialized memory allocation and refactoring cleanup logic. Additionally, new tests have been added to cover the new functionality.
|
@copilot code review[agent]
|
|
@Simon9997 I've opened a new pull request, #34691, to work on those changes. Once the pull request is ready, I'll request review from you. |
3a0d3d9 to
057f444
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 39 out of 46 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
057f444 to
54bc0d8
Compare
|
@copilot 【提交背景】
【审查范围与原则】
【输出格式(强制)】
【TDengine/C 内核专项检查清单(逐项覆盖,不要省略)】
B. 并发/一致性
C. 错误处理/接口契约
D. 数据结构/序列化/磁盘格式
E. 性能热点(数据库特有)
F. 可移植性/编译
|
|
@Simon9997 I've opened a new pull request, #34694, to work on those changes. Once the pull request is ready, I'll request review from you. |
54bc0d8 to
cda01bd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 50 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.
cda01bd to
eb4c5ad
Compare
eb4c5ad to
c45d0a7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 50 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| break; | ||
| } | ||
| case WINDOW_TYPE_STATE: { | ||
| if (nodeType(pWindow->pStateExpr) != QUERY_NODE_COLUMN) { |
| SFunctionNode *pFunction = (SFunctionNode *)pFunc; | ||
| if (windowFuncHasTagPKParam(pFunction)) { | ||
| SFunctionNode* pFunction = (SFunctionNode*)pFunc; | ||
| if (functionHasTagParam(pFunction)) { |
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.