Repository navigation
Description
Why this is needed
Financial/risk and telemetry workflows commonly use smoothed indicators, drawdown, streaks and local trends. Each library has seeding, warmup and missing-data conventions; repeatedly porting formulas increases maintenance and validation cost.
Requested behavior and scope
Add documented SQL/migration equivalents for the missing EMA/DEMA/TEMA/T3/KAMA/Wilder/WMA/SMA/TRIMA family and rolling drawdown/streak/trend operators. Prioritize well-defined profiles with warmup and NULL semantics rather than claiming all TA-Lib defaults are identical. The verified price fixture 100,120,90,110 has cumulative maximum drawdown ratios 0,0,0.25,0.25 using ordinary SQL windows. Bounded-frame drawdown must use frame-local peaks, not the all-history peak. No live DolphinDB/TA-Lib performance comparison is claimed.
Tested revision / existing issue check
- MatrixOne commit:
23d8f61252f3017dff218b530817a240206fd762. - Existing issues were searched before filing; related requests/closed fixes are distinguished above.
- All data below is synthetic. The probe is read-only and requires no persisted tables.
Executable unsupported case
SELECT mmaxDrawdown(CAST(1 AS DOUBLE),3) result;Actual MO result, reproduced 3/3:
(20105, "not supported: function or operator 'mmaxdrawdown'")
This probe checks entry-name availability only. A rejection does not establish that the business calculation is impossible or that this is a valid DolphinDB script signature. The requested mathematical operation is defined above and checked by the independent profile below.
Additional actually executed cases
Each listed rejection was executed three times on the same synthetic fixture.
| Case | MO result | Declared expected values / scope |
|---|---|---|
ema_entry |
rejected 3/3 | Entry resolution only; no invented engine result |
kama_entry |
rejected 3/3 | Entry resolution only; no invented engine result |
mmaxDrawdown_entry |
rejected 3/3 | Entry resolution only; no invented engine result |
cumPositiveStreak_entry |
rejected 3/3 | Entry resolution only; no invented engine result |
Working SQL control / alternative
The following control was executed 3/3 and its complete output values were checked, not merely execution success:
WITH a AS (SELECT id,price,MAX(price) OVER(ORDER BY id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) peak
FROM (
SELECT 1 id,CAST(100 AS DOUBLE) price
UNION ALL SELECT 2,120
UNION ALL SELECT 3,90
UNION ALL SELECT 4,110) fixture) SELECT id,MAX(CAST(1 AS DOUBLE)-price/peak) OVER(ORDER BY id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) result FROM a ORDER BY id;| Control | Verified values |
|---|---|
cumulative_max_drawdown_control |
0, 0, 0.25, 0.25 |
Acceptance / regression coverage
Retain the self-contained fixture and assert complete values, NULL bits and row alignment. Add partitions, ties, empty/all-NULL frames, frame-entry/exit and type boundaries appropriate to this operator. Validate named/API availability separately from mathematical rewrites. Benchmark any claimed state/performance advantage with identical data and correctness rules; no speedup is asserted by these small tests.
Subsequent SELECT 1 succeeded after the test matrix. DolphinDB references are official documentation; no DolphinDB runtime or all-parameter parity is claimed.
Activity
XuPeng-SH commentedon Oct 12, 2026
Triage decision: defer.
Reason: this is a specialized window/time-series capability. The report establishes a syntax or API gap, but does not show a confirmed customer blocker or near-term roadmap commitment. The umbrella report also notes that many profiles can be composed from existing SQL and does not provide a native-performance comparison.
Promote when a concrete customer workload or roadmap commitment is identified and correctness/performance acceptance criteria are agreed.
3 remaining items
gouhongshen commentedon Oct 24, 2026
PR #31017 is trying to fix this issue.
test: define drawdown ratios and TEMA/T3 chain warmup in BVT
feat: technical-indicator window kernels and rolling risk analytics (#…
gouhongshen commentedon Oct 24, 2026
PR #31017 has merged and is awaiting manual validation. The issue remains open.
XuPeng-SH commentedon Oct 24, 2026
Manual validation for merged PR #31017 on an isolated local service:
dae02bbaaaa18aac7fa9b788e42f4483b3adf091; executable SHA-256b534b2c2d33683eab3572971284093f6d584b626f4f94691b6dc050690c2d21c.KILL QUERYreturned error 1317 in 329 ms; the same connection recovered. A separate expected SQL error was followed by successful SELECT and EMA on that connection.This is a scoped pass on one local CN, not multi-CN/distributed or broad scale/performance acceptance. A focused Go unit command timed out twice during dependency compilation (5 min and 8 min); no unit tests ran, so those attempts are not counted as product failures. No defect was reproduced in the SQL cases above. Keeping the issue open for testing/acceptance.
XuPeng-SH commentedon Oct 25, 2026
Additional fresh-round evidence supersedes the earlier note that focused Go tests had only timed out during compilation. On isolated source
aeaa273daf588a9988ba423915d3ae6b8c82124a/ service SHA-256450363d5ec5e693bdd7ded44565b3b0ab1addcb807d3f9569c5d5eedeb1486e4, the 69-statement SQL case and 15 independent math-oracle result sets still pass. A warm-cache focusedTestIndicatorsuite in./pkg/sql/colexec/windowthen exited 0 after a 17-minute dependency compile; package test time was 8.975s. It included cancellation/reuse, cancellation latency, empty/all-NULL partitions, seed-ring checks, procedure-M/U oracles/fuzzing, subnormal/ULP scans, drawdown, documented errors, and lifecycle tests. The log has two small mpool outstanding-ownership WARNs (64 and 512 bytes) while the associated lifecycle tests passed. Command:go test -vet=off ... ./pkg/sql/colexec/window -run '^TestIndicator' -count=1 -vwith one worker,GOMEMLIMIT=1536MiB, and the retained native CGo libraries. This remains focused single-CN coverage; no full package/repository or multi-CN benchmark is claimed. The issue was already assigned to Ariznawlll, so assignment is unchanged. Local log:round2-aeaa273-31017-indicator-go-tests-retry30m.log.Ariznawlll commentedon Oct 26, 2026
测试版本
5fe08a3307e246e1ab9951ab690b50557af0f509;LOG/TN/CN 在同一进程、单 CN、独立数据目录及 SQL 端口 6201。测试时官方main为4769417cdce5531c9771644eca49f1e71d8f654c;本地源码比它少一个仅涉及 SHOW/ALTER 默认值及 dump 的提交,不把本轮称作该最新 SHA 的实测。309a0ca650e0c55e90292767fd61e4976818d66d执行已合入的 SQL/golden。用户原工作区没有切分支或改文件。原问题验证
原 issue 中不带
OVER的ema、kama、mmaxDrawdown、cumPositiveStreak探针不再是“不支持函数”错误,而是窗口函数必须带OVER的预期诊断;这只验证入口存在,不把探针当作有效计算。有效窗口调用与 golden 逐条比较。原文100,120,90,110的普通 SQL 累计最大回撤对照仍为0,0,0.25,0.25;有界mmaxDrawdown另按窗口内峰值核对,避免把累计峰值误当局部峰值。Happy Path 覆盖
func_indicator_kernels.sql:69 条语句,69 成功、0 失败、0 异常、0 跳过;每条实际结果与配套.result比对,不只是 SQL 能执行。SMA/WMA/TRIMA/EMA/Wilder/KAMA/DEMA/TEMA/T3的分区、混合正负数、全 NULL 分区、warmup 与分区重置;8 行链式序列检查 TEMA/T3 首个非 NULL 值及后续更新;常量输入、整数输入和周期 1。2+1、ABS(3)、LENGTH('abc')、GREATEST(2,3));周期上限 1024。回撤周期 4/3/2/1 覆盖峰值进入与退出窗口、零谷值、负谷值、非正峰值及 NULL;另核对 KAMA 平坦段、正向 streak 及普通 SQL 的 SMA/趋势组合配方。Unhappy Path 覆盖
白盒验证
本轮未重新运行 Go UT、race 或性能基准;此前研发的聚焦
TestIndicator实测及其范围见已有验证评论,不计入本轮 69 条黑盒结果。回归测试
实现 PR #31017 已合入;本轮复跑的是 SQL 用例 与配套 golden。本次没有新增回归代码或 PR。
测试证据
/private/tmp/qa-three-features-local.TrLbxB/indicator_test.log,摘要TOTAL=69, SUCCESS=69, FAILED=0, ABNORAML=0, SUCCESS RATE=100%。测试结论
测试通过。
Ariznawlll commentedon Oct 26, 2026
测试补充:已执行验证与回归跟踪
测试版本
2026-10-26,本地 MatrixOne 源码
5fe08a3307e246e1ab9951ab690b50557af0f509。SQL/golden 验证采用隔离单 CN 环境;新增 MOTR 用例另在同一进程内的两个 CN 服务、共享 LOG/TN 环境验证,不等同于 TKE 独立 CN Pod 验证。原问题验证
已执行
func_indicator_kernels.sql,69/69 条成功,0 失败、0 异常、0 跳过,实际结果与 golden 一致。原文价格序列100,120,90,110的累计回撤对照为0,0,0.25,0.25;有界回撤按窗口内峰值另行核对。Happy Path 覆盖
Unhappy Path 覆盖
缺少排序、不支持的显式 frame、周期 0/1025、越界/非整数/列引用周期,以及非有限计算结果,均核对预期错误;错误后继续执行正常 SQL。新增 MOTR 与 #29947 用例一起以
--repeat 3执行,共 6/6 通过。白盒验证
本次未新增或重跑 Go UT/race;此前聚焦 TestIndicator 的白盒证据见已有验证记录,与本次黑盒结果分开统计。
回归测试
issue_29949_indicator_multicn.py。测试证据
本地完整 SQL 验证记录及 MOTR 用例与本地复跑摘要。
按本次确认的验收安排,先关闭本 feature;计划于 2026-10-27 执行的 TKE 回归仍标为待执行,不计入当前通过证据。当前未宣称长期稳定性、性能收益或与其他产品全部默认行为一致。下述结论仅针对上述已执行的本地功能验证。
测试结论
测试通过。