2010YOUY01 opened a new issue, #17770:
URL: https://github.com/apache/datafusion/issues/17770
### Describe the bug
datafusion-cli is compiled from the latest main commit 5bbdb7eb1
The query is able to run in DuckDB but fails in DataFusion
```
D WITH suppliers AS (
SELECT *
FROM (VALUES (1, 10.0), (1, 20.0)) AS t(nation, acctbal)
)
SELECT
ROW_NUMBER() OVER (PARTITION BY nation ORDER BY acctbal DESC) AS rn
FROM suppliers AS s
WHERE acctbal > (
SELECT AVG(acctbal) FROM suppliers
);
┌───────┐
│ rn │
│ int64 │
├───────┤
│ 1 │
└───────┘
> WITH suppliers AS (
SELECT *
FROM (VALUES (1, 10.0), (1, 20.0)) AS t(nation, acctbal)
)
SELECT
ROW_NUMBER() OVER (PARTITION BY nation ORDER BY acctbal DESC) AS rn
FROM suppliers AS s
WHERE acctbal > (
SELECT AVG(acctbal) FROM suppliers
);
Optimizer rule 'common_sub_expression_eliminate' failed
caused by
Error during planning: Window has mismatch between number of expressions (1)
and number of fields in schema (0)
```
### To Reproduce
_No response_
### Expected behavior
_No response_
### Additional context
Found by SQLStorm #17698
--
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]