Skip to content

[Bug]: unsupported time-window units log a compile panic instead of a normal error #26980

Closed

Description

@XuPeng-SH

Summary

interval(timestamp, 1, month|week|year) is not supported, but compiling these validly parsed time-window statements logs panic in compile with a full stack trace in the CN service log. The client receives an ordinary unsupported-unit error and the process remains alive, so this is not a crash, but unsupported SQL should not take the panic/error path.

Environment

  • Repository: matrixorigin/matrixone
  • Branch: main
  • Commit: c3ba9c7df14388956cb38d78681c6c35b75c42b8
  • Host: Debian x86_64, 10.222.1.55
  • SQL endpoint: 127.0.0.1:6001
  • Test artifact: mo-service with go version -m provenance for the commit above

Reproduction

CREATE TABLE ts_bounds (
  event_ts TIMESTAMP(6),
  value INT
);

SELECT _wstart, _wend, COUNT(*)
FROM ts_bounds
INTERVAL(event_ts, 1, month);

SELECT _wstart, _wend, COUNT(*)
FROM ts_bounds
INTERVAL(event_ts, 1, week);

SELECT _wstart, _wend, COUNT(*)
FROM ts_bounds
INTERVAL(event_ts, 1, year);

Client result:

ERROR 20105 (HY000): not supported: Time Window aggregate only support SECOND, MINUTE, HOUR, DAY as the time unit

At the same time, service.log records entries like:

"msg":"panic in compile",
"sql":"... interval(event_ts,1,month)",
"error":"not supported: Time Window aggregate only support SECOND, MINUTE, HOUR, DAY as the time unit"

with a full compile stack trace. The service continues serving queries after the statement.

Expected behavior

Either support the requested calendar unit, or reject it through the normal SQL error path without logging an internal panic/stack trace. A user-level unsupported feature should not appear as a server panic in observability systems.

Scope and workaround

DATE_TRUNC('week'|'month'|'quarter'|'year', event_ts) works for calendar rollups. Fixed windows in SECOND, MINUTE, HOUR, and DAY remain available. This issue is a non-blocking robustness/diagnostic problem unless unsupported-unit requests are treated as service panic incidents.

Activity

  1. added
    kind/bug
    severity/s0
    on Aug 11, 2026
  2. added a commit that references this issue on Aug 12, 2026
  3. Ariznawlll commented on Aug 13, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:main
    • commit:c21d44189f5c6cab4cd4d5a277ba9867d0d47b34
    • 部署方式:本地单节点拓扑(1 CN + 1 TN + 1 Log)
    • 测试日期:2026-08-13

    原问题验证

    复测 Time Window 不支持的时间单位。客户端现在收到正常、短格式的 20105 not supported SQL 错误;CN 日志不再记录 compile panic 或 Go stack。

    Happy Path 覆盖

    1. 支持的 SECOND/MINUTE/HOUR/DAY 单位继续返回正确窗口。
    2. 非法单位拒绝后合法查询立即恢复。
    3. 源表内容及会话保持正常。

    Unhappy Path 覆盖

    1. INTERVAL 与 SLIDING 的 MONTH、WEEK、YEAR、QUARTER 组合均走普通错误路径。
    2. 测试期间服务日志中 panic in compile、panic in pipeline、panic:、fatal error 均为 0。
    3. 拒绝后源表无修改,临时库无残留。

    白盒验证

    执行 time-window planner 定向 Go UT,通过;同时对本轮 SQL 执行后的服务日志做独立 panic/fatal 关键字审计,命中数为 0。

    回归测试

    已加入 motr PR #109;测试文件:issue_26980_time_window_units.test。

    单位合法性与数据量无关,不需要补充大数据量测试用例。

    测试证据

    • 历史版本 c3ba9c7df14388956cb38d78681c6c35b75c42b8 可复现 compile panic/stack 输出。
    • 最新 main 对六个新增 case 统一执行 MOTR --repeat 3:18/18 成功,249/249 条断言通过;本 case 3/3 通过。
    • 服务版本复核为 c21d44189,测试后仍可正常查询。

    测试结论

    测试通过。

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

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions