NoahKusaba opened a new issue, #2951:
URL: https://github.com/apache/datafusion-ballista/issues/2951
**Describe the bug**
With the adaptive planner, `count(c3) OVER (PARTITION BY c2)` returns counts
that are too small when the query also has `row_number() OVER (PARTITION BY c2,
c9)`. Each `c2` partition seems to be split across tasks, and each task counts
only its share. The static planner returns the right counts.
**To Reproduce**
Standalone Ballista on `main` (446fa54c9) with
`ballista.planner.adaptive.enabled = true` and default settings otherwise.
`aggregate_test_100.csv` is in apache/arrow-testing
(`testing/data/csv/aggregate_test_100.csv` in a DataFusion checkout).
```sql
CREATE EXTERNAL TABLE aggregate_test_100 (
c1 VARCHAR NOT NULL, c2 TINYINT NOT NULL, c3 SMALLINT NOT NULL, c4
SMALLINT, c5 INT,
c6 BIGINT NOT NULL, c7 SMALLINT NOT NULL, c8 INT NOT NULL, c9 BIGINT
UNSIGNED NOT NULL,
c10 VARCHAR NOT NULL, c11 FLOAT NOT NULL, c12 DOUBLE NOT NULL, c13 VARCHAR
NOT NULL
)
STORED AS CSV LOCATION 'testing/data/csv/aggregate_test_100.csv'
OPTIONS ('format.has_header' 'true');
SELECT c9,
row_number() OVER (PARTITION BY c2, c9) AS row_number,
count(c3) OVER (PARTITION BY c2) AS count_c3
FROM aggregate_test_100
ORDER BY c9
LIMIT 5;
```
Adaptive planner:
```
c9 | row_number | count_c3
28774375 | 1 | 2
63044568 | 1 | 4
141047417 | 1 | 14
141680161 | 1 | 3
145294611 | 1 | 4
```
**Expected behavior**
The same result as DataFusion and the static planner: `count_c3` is 23, 22,
14, 22, 22.
**Additional context**
Found by running DataFusion's sqllogictest files on Ballista (#2945):
`pg_compat/pg_compat_window.slt:795`. The same query wrapped in `GROUP BY c2`
returns the right counts, so the split shows up only when the window output is
read row by row.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]