jonahgao opened a new issue, #9794:
URL: https://github.com/apache/arrow-datafusion/issues/9794
### Describe the bug
Currently, DataFusion allows their schemas to be different, which may lead
to some query failures or incorrect results.
### To Reproduce
Run queries on CLI
```sh
DataFusion CLI v36.0.0
❯ WITH RECURSIVE my_cte AS(
SELECT 1::int AS a
UNION ALL
SELECT a+2 FROM my_cte WHERE a<3
) SELECT * FROM my_cte;
Arrow error: Invalid argument error: Invalid comparison operation: Int64 <
Int32
❯ WITH RECURSIVE my_cte AS (
SELECT 1::bigint AS a
UNION ALL
SELECT a+2, 'a','c' FROM my_cte WHERE a<3
) SELECT * FROM my_cte;
+---+---+---+
| a | | |
+---+---+---+
| 1 | | |
| 3 | a | c |
+---+---+---+
2 rows in set. Query took 0.020 seconds.
❯ WITH RECURSIVE my_cte AS (
SELECT 1 AS a
UNION ALL
SELECT 'abc' FROM my_cte WHERE CAST(a AS text) !='abc'
) SELECT * FROM my_cte;
+-----+
| a |
+-----+
| 1 |
| abc |
+-----+
2 rows in set. Query took 0.012 seconds.
```
### Expected behavior
- Query 1 should be successful.
- Query 2 and query 3 should fail, because the number of columns and the
data types between the output rows are not the same.
### Additional context
_No response_
--
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]