Description
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-servicewithgo version -mprovenance 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
fix time window units (#27012)
Ariznawlll commentedon Aug 13, 2026
测试版本
mainc21d44189f5c6cab4cd4d5a277ba9867d0d47b34原问题验证
复测 Time Window 不支持的时间单位。客户端现在收到正常、短格式的
20105 not supportedSQL 错误;CN 日志不再记录 compile panic 或 Go stack。Happy Path 覆盖
Unhappy Path 覆盖
panic in compile、panic in pipeline、panic:、fatal error均为 0。白盒验证
执行 time-window planner 定向 Go UT,通过;同时对本轮 SQL 执行后的服务日志做独立 panic/fatal 关键字审计,命中数为 0。
回归测试
已加入 motr PR #109;测试文件:
issue_26980_time_window_units.test。单位合法性与数据量无关,不需要补充大数据量测试用例。
测试证据
c3ba9c7df14388956cb38d78681c6c35b75c42b8可复现 compile panic/stack 输出。--repeat 3:18/18 成功,249/249 条断言通过;本 case 3/3 通过。c21d44189,测试后仍可正常查询。测试结论
测试通过。
fix time window units (matrixorigin#27012)
fix time window units (matrixorigin#27012)
fix time window units (matrixorigin#27012)