4paradigm / 4paradigm/OpenMLDB

Bug: fail to deal with multiple windows serially when window union tables

Open
#869 0 comments 0 reactions 2 assignees Claimed by @jingchen2222 View on GitHub
enhancement
Dominant language
C++
Stars
1.7k
Forks
331
Avg merge
12d 12h
Merged PRs (30d)
1

Description

Issue tracker is **ONLY** used for reporting bugs. New features should be discussed on our discussion

```yaml
-
id: 26
desc: 两个union,不同的maxsize
mode: cluster-unsupport
inputs:
-
columns : ["id int","c1 string","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- [1,"aa",20,30,1.1,2.1,1590738990000,"2020-05-01"]
- [2,"aa",21,31,1.2,2.2,1590738990001,"2020-05-01"]
- [5,"aa",24,34,1.5,2.5,1590738990004,"2020-05-02"]
-
columns : ["id int","c1 string","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- [3,"aa",22,32,1.3,2.3,1590738990002,"2020-05-01"]
-
columns : ["id int","c1 string","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- [4,"aa",23,33,1.4,2.4,1590738990003,"2020-05-01"]
sql: |
SELECT id, c1, sum(c4) OVER w1 as w1_c4_sum, sum(c4) OVER w2 as w2_c4_sum FROM {0} WINDOW
w1 AS (UNION {1} PARTITION BY {0}.c1 ORDER BY {0}.c7 ROWS_RANGE BETWEEN 5 PRECEDING AND CURRENT ROW MAXSIZE 4),
w2 AS (UNION {1},{2} PARTITION BY {0}.c1 ORDER BY {0}.c7 ROWS_RANGE BETWEEN 5 PRECEDING AND CURRENT ROW MAXSIZE 2);
expect:
order: id
columns: ["id int","c1 string","w1_c4_sum bigint","w2_c4_sum bigint"]
rows:
- [1,"aa",30,30]
- [2,"aa",61,61]
- [5,"aa",127,67]
```
## Expected Behavior

SQL runs successfully under online mode and offline mode.
## Current Behavior

```
W1208 20:42:01.557590 629636544 expr_node.cc:35] ColumnRef should be transformed out before infer pass
W1208 20:42:01.558408 629636544 expr_node.cc:35] ColumnRef should be transformed out before infer pass
I1208 20:42:01.558436 629636544 udf_library.cc:272] Resolve 'sum'to sum(list_int64)
W1208 20:42:01.558599 629636544 expr_node.cc:35] ColumnRef should be transformed out before infer pass
W1208 20:42:01.558789 629636544 physical_op.cc:35] Schemas size aren't consistent: expect size 9, real size 8
W1208 20:42:01.558799 629636544 physical_op.h:1139] Union Table and window input schema aren't consistent
I1208 20:42:01.559028 629636544 engine_test_base.cc:398] SQL Compile take 4.463 milliseconds
I1208 20:42:01.559046 629636544 engine_test_base.cc:401] Fail to add window union table
(At /Users/chenjing/work/chenjing/OpenMLDB/hybridse/src/vm/sql_compiler.cc:261)
(At /Users/chenjing/work/chenjing/OpenMLDB/hybridse/src/vm/sql_compiler.cc:166)
(Caused by) Fail to generate physical plan batch mode
(At /Users/chenjing/work/chenjing/OpenMLDB/hybridse/src/vm/transform.cc:1711)
(Caused by) Fail to transform query statement
(At /Users/chenjing/work/chenjing/OpenMLDB/hybridse/src/vm/transform.cc:103)
(At /Users/chenjing/work/chenjing/OpenMLDB/hybridse/src/vm/transform.cc:1226)
(Caused by) Fail to add window union table

```
## Possible Solution

## Steps to Reproduce

1.
2.
3.
4.

## Context (Environment)

## Detailed Description

## Possible Implementation

Contributor guide

Open the contributing guide

Research direction

The error occurs in sql_compiler.cc and transform.cc when adding a window union table with multiple windows and different MAXSIZE values. Examine the schema consistency checks in physical_op.cc and physical_op.h. Start by running the provided YAML test case to reproduce the 'Schemas size aren't consistent' error, then trace through the window union table handling in the SQL compiler.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.