4paradigm / 4paradigm/OpenMLDB

lag correctness: wrong result used as parameter of other udaf

Đang mở
#3,299 1 bình luận 0 reaction 1 người được giao Được @aceforeverd nhận Xem trên GitHub
bug execute-engine udf
Ngôn ngữ chính
C++
Star
1.7k
Fork
331
Merge trung bình
12 ngày 12 giờ
Pull request đã merge (30 ngày)
1

Mô tả

```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**).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
sql
Lĩnh vực
databases, machine-learning
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.