4paradigm / 4paradigm/OpenMLDB

lag correctness: wrong result used as parameter of other udaf

未关闭
#3,299 1 条评论 0 个 reaction 已指派 1 人 已被 @aceforeverd 认领 在 GitHub 查看
bug execute-engine udf
主要语言
C++
星标
1.7k
派生
331
平均合并
12 天 12 小时
30 天内合并 PR
1

描述

```yaml
- id: 66
sql: |
select
idx,
sum_where(val, val > lag(val, 1)) over w as out,
from t1
window w as (
partition by gp order by ts
rows_range between 10s preceding and 1s preceding
)
inputs:
- name: t1
columns: ["idx int", "gp int", "val int", "ts timestamp"]
indexs: ['idx:gp:ts']
data: |
100, 1, 1, 1000
200, 1, 2, 2000
300, 1, 1, 3000
400, 1, 2, 4000
expect:
columns:
- idx int
- out int32
order: idx
data: |
100, NULL
200, NULL
300, NULL
400, 2
```

`sum_where` and `lag` compute over the same history window [10s - 1s] , however does not meet the specification for `lag` (**always evaluated based on current row**).

贡献指南

打开贡献指南

调研方向

The issue is about the lag function within a window in OpenMLDB, a C++ database for machine learning. The test case in the issue body shows the SQL query and expected output. Investigate the window function evaluation logic, likely in the SQL engine or UDAF implementation. Look for where lag is computed relative to the current row versus the window frame. Running the provided test will show the discrepancy. The fix involves ensuring lag uses the correct row context within the window.

由索引模型根据 Issue 内容生成。

评估

技术栈
sql
领域
databases, machine-learning
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。