Skip to content

fix time window units - #27012

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
daviszhen:0812-fix-time-window-units
Aug 12, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
daviszhen:0812-fix-time-window-units

Conversation

@daviszhen

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #26980

What this PR does / why we need it:

• 此分支当前主要修改了 time-window 不支持时间单位的错误路径:

  • 在 planner/binder 阶段提前校验 INTERVAL/SLIDING 的单位,只允许 SECOND/MINUTE/HOUR/DAY。

  • 对 MONTH/WEEK/YEAR/QUARTER 返回普通 not supported SQL 错误,避免进入 compile 阶段触发 panic in compile 日志。

  • 保留执行器侧原有 unsupported 兜底逻辑,但正常 SQL 已不会走到 compile panic-path。

  • 补充单测覆盖:

    • interval(..., month/week/year/quarter)
    • sliding(..., month/week/year/quarter)
    • validator 对非法 unit 字符串的处理。
  • 补充 BVT 覆盖上述 SQL 错误路径,并移除了 parser 直接拒绝的 century case。

验证已通过目标 Go 测试和 git diff --check。

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep review on exact head cdbd109: APPROVE.

The planner now rejects unsupported INTERVAL and SLIDING units before helper binding and before a TIME_WINDOW plan can reach constructTimeWindow, while preserving the executor capability set (SECOND/MINUTE/HOUR/DAY). I traced the full parser -> binder -> plan node -> compile -> timewin path and checked all parser-reachable interval categories; no correctness blocker found.

Validation:

  • CI is green on this exact head.
  • pkg/sql/plan full package tests pass.
  • pkg/sql/colexec/timewin and pkg/sql/compile tests pass.
  • pkg/sql/plan build and vet pass.
  • Reviewer-only public parser->BuildPlan matrix passed for all four supported units, all 16 other recognized interval units, and unsupported SLIDING units; the temporary test was removed.
  • Q1-Q3 unhappy-path audit: no new resource ownership, wait-for, or unbounded-growth edge.

@aptend aptend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep-reviewed exact head cdbd109. The planner-side unit validation rejects every unit the time-window executor cannot represent before the compile path, covers both INTERVAL and SLIDING, preserves the executor fallback, and adds focused unit/BVT coverage. Focused planner tests pass locally with the required CGO/thirdparties setup; GitHub CI is green. No blocking issue found.

@mergify mergify Bot added the queued label Aug 12, 2026
@mergify

mergify Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-12 08:56 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-08-12 09:24 UTC · at 9a9948d1d266b024a2ef4e9fa7a79a3ce9a6c013

This pull request spent 28 minutes 19 seconds in the queue, with no time running CI.

Reason

Pull request #27012 has been merged manually at bd34211

Hint

You were too fast!

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit bd34211 into matrixorigin:main Aug 12, 2026
25 of 26 checks passed
@mergify mergify Bot removed the queued label Aug 12, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#26980

## What this PR does / why we need it:

• 此分支当前主要修改了 time-window 不支持时间单位的错误路径:

- 在 planner/binder 阶段提前校验 INTERVAL/SLIDING 的单位,只允许
SECOND/MINUTE/HOUR/DAY。
- 对 MONTH/WEEK/YEAR/QUARTER 返回普通 not supported SQL 错误,避免进入 compile 阶段触发
panic in compile 日志。
  - 保留执行器侧原有 unsupported 兜底逻辑,但正常 SQL 已不会走到 compile panic-path。
  - 补充单测覆盖:
      - interval(..., month/week/year/quarter)
      - sliding(..., month/week/year/quarter)
      - validator 对非法 unit 字符串的处理。

  - 补充 BVT 覆盖上述 SQL 错误路径,并移除了 parser 直接拒绝的 century case。

  验证已通过目标 Go 测试和 git diff --check。

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#26980

## What this PR does / why we need it:

• 此分支当前主要修改了 time-window 不支持时间单位的错误路径:

- 在 planner/binder 阶段提前校验 INTERVAL/SLIDING 的单位,只允许
SECOND/MINUTE/HOUR/DAY。
- 对 MONTH/WEEK/YEAR/QUARTER 返回普通 not supported SQL 错误,避免进入 compile 阶段触发
panic in compile 日志。
  - 保留执行器侧原有 unsupported 兜底逻辑,但正常 SQL 已不会走到 compile panic-path。
  - 补充单测覆盖:
      - interval(..., month/week/year/quarter)
      - sliding(..., month/week/year/quarter)
      - validator 对非法 unit 字符串的处理。

  - 补充 BVT 覆盖上述 SQL 错误路径,并移除了 parser 直接拒绝的 century case。

  验证已通过目标 Go 测试和 git diff --check。

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#26980

## What this PR does / why we need it:

• 此分支当前主要修改了 time-window 不支持时间单位的错误路径:

- 在 planner/binder 阶段提前校验 INTERVAL/SLIDING 的单位,只允许
SECOND/MINUTE/HOUR/DAY。
- 对 MONTH/WEEK/YEAR/QUARTER 返回普通 not supported SQL 错误,避免进入 compile 阶段触发
panic in compile 日志。
  - 保留执行器侧原有 unsupported 兜底逻辑,但正常 SQL 已不会走到 compile panic-path。
  - 补充单测覆盖:
      - interval(..., month/week/year/quarter)
      - sliding(..., month/week/year/quarter)
      - validator 对非法 unit 字符串的处理。

  - 补充 BVT 覆盖上述 SQL 错误路径,并移除了 parser 直接拒绝的 century case。

  验证已通过目标 Go 测试和 git diff --check。

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants