Repository navigation
Description
Summary
MatrixOne's native Time Window aggregation cannot express sub-second windows. The SQL grammar accepts MICROSECOND as a time unit, but the Time Window executor only supports SECOND, MINUTE, HOUR, and DAY.
This is a time-series capability gap for high-frequency telemetry, industrial sensor, market-data, and trace workloads. Partition rotation is not a substitute for query-time bucketing, and partition support should not be assumed as a workaround.
Environment
- Repository:
matrixorigin/matrixone - Branch:
main - Commit:
c3ba9c7df14388956cb38d78681c6c35b75c42b8 - Host used for capability validation: Debian x86_64,
10.222.1.55 - SQL endpoint during validation:
127.0.0.1:6001
Reproduction
CREATE TABLE ts_hf (
event_ts TIMESTAMP(6),
device_id BIGINT,
value DOUBLE
);
INSERT INTO ts_hf VALUES
('2026-08-12 10:00:00.000100', 1, 10),
('2026-08-12 10:00:00.000900', 1, 20),
('2026-08-12 10:00:00.001100', 1, 30);
SELECT _wstart, _wend, COUNT(*), AVG(value)
FROM ts_hf
INTERVAL(event_ts, 1000, MICROSECOND);Observed result:
ERROR 20105 (HY000): not supported: Time Window aggregate only support SECOND, MINUTE, HOUR, DAY as the time unit
The grammar currently parses INTEGRAL time_unit, and time_unit includes MICROSECOND, but pkg/sql/colexec/timewin/types.go::calcDatetime rejects every unit outside SECOND/MINUTE/HOUR/DAY.
A decimal-second form is not an alternative because the Time Window grammar requires an integer interval value:
-- parser rejection
SELECT _wstart, _wend, COUNT(*)
FROM ts_hf
INTERVAL(event_ts, 0.001, SECOND);Expected behavior
Support fixed-duration sub-second windows in the native Time Window operator, at minimum:
INTERVAL(event_ts, 1000, MICROSECOND)
SLIDING(100, MICROSECOND)The behavior should compose with existing Time Window capabilities:
_wstart/_wend- tumbling and sliding windows
GAPFILLFILL(NULL|PREV|NEXT|LINEAR|VALUE)PARTITION BYTIMESTAMP(6)/DATETIME(6)boundary correctness
Why this is a real time-series gap
DATE_TRUNC now covers calendar and fixed rollups down to one second, but it does not provide arbitrary sub-second buckets, sliding windows, or native gap filling. generate_series can produce timestamps but does not replace the Time Window operator for aggregation.
This is independent of table partitioning: partition lifecycle cannot implement 100 µs / 1 ms aggregation windows.
Related issues
- [Feature Request]: Time-bucketing / date-truncation functions (date_trunc, to_start_of_minute, ...) #24551 added/completed
DATE_TRUNC, but its supported precision stops at seconds. - [Bug]: interval time windows round fractional timestamps into the next bucket #26975 tracks incorrect fractional-timestamp bucket boundaries in supported Time Window units.
- [Bug]: unsupported time-window units log a compile panic instead of a normal error #26980 tracks the internal panic log path for unsupported Time Window units; it does not track adding sub-second support.
- [Feature Request]: Native table TTL (automatic expiry) #24552 tracks row/partition TTL and is unrelated to query-time window precision.
Activity
fix sub-second units (#27017)
Ariznawlll commentedon Aug 15, 2026
验证 #26983 时发现一个独立问题:对 MICROSECOND Time Window 生成的 _wstart/_wend 执行 TIMESTAMPDIFF(MICROSECOND, _wstart, _wend) 会在当前 main(a1e161ad3e0fc83cabfc66db8b4d5419d16c9ee4)稳定触发 ERROR 20101 的 TIMESTAMP/DATETIME 类型 panic,单机和 2-CN proxy 均为 3/3。
已新建关联 bug:#27189。原始 MICROSECOND 聚合路径本身可通过,本问题单独跟踪窗口边界类型处理。
Ariznawlll commentedon Aug 15, 2026
补充验收结果(最新 main,commit a1e161a):
已通过的功能覆盖:
仍存在的边界类型问题:
该问题已在关联 bug #27189 跟踪。当前 MICROSECOND 聚合主路径已通过,但 TIMESTAMP 边界类型兼容性仍未完成,建议修复或明确拆分后再关闭本 issue。
fix sub-second units (matrixorigin#27017)
fix sub-second units (matrixorigin#27017)
fix sub-second units (matrixorigin#27017)