appletreeisyellow opened a new issue, #24701:
URL: https://github.com/apache/datafusion/issues/24701
### Describe the bug
When a query renames a column using a DataFusion reserved name, it currently
fails with an error message that does not clearly tell the user how to resolve
the issue. For example:
```
Arrow error: Invalid argument error: Invalid comparison operation: Float64 >
Boolean
```
Even though the user's query doesn't contain a `Float64 > Boolean`
comparison, the error message is misleading.
It would be good to improve the error message so that it clearly tells the
user to choose a different column name instead of using a DF reserved name.
### To Reproduce
```sql
❯ datafusion-cli
DataFusion CLI v55.0.0
> CREATE TABLE readings(range_idx INT) AS VALUES (1);
0 row(s) fetched.
Elapsed 0.039 seconds.
-- ❌ bug reproducer
> SELECT CASE WHEN (range_idx = 1) THEN normalized_value ELSE 0.0 END AS
result
FROM (
SELECT range_idx,
CASE WHEN (range_idx = 1) THEN capped_value ELSE 0.0 END AS
normalized_value
FROM (
SELECT range_idx,
CASE WHEN (rollover_value > "__common_expr_2") THEN
rollover_value ELSE 0.0 END AS capped_value
FROM (
SELECT CASE WHEN (range_idx = 1) THEN 1.0 ELSE 0.0 END AS
"__common_expr_2",
range_idx,
CASE WHEN (range_idx = 1) THEN 2.0 ELSE 0.0 END AS
rollover_value
FROM readings
)
)
);
Arrow error: Invalid argument error: Invalid comparison operation: Float64 >
Boolean
```
```sql
-- ✅ same query, column renamed to `threshold` (not anything
`__common_expr_<n>`). Returns 2.0.
> SELECT CASE WHEN (range_idx = 1) THEN normalized_value ELSE 0.0 END AS
result
FROM (
SELECT range_idx,
CASE WHEN (range_idx = 1) THEN capped_value ELSE 0.0 END AS
normalized_value
FROM (
SELECT range_idx,
CASE WHEN (rollover_value > threshold) THEN rollover_value ELSE
0.0 END AS capped_value
FROM (
SELECT CASE WHEN (range_idx = 1) THEN 1.0 ELSE 0.0 END AS threshold,
range_idx,
CASE WHEN (range_idx = 1) THEN 2.0 ELSE 0.0 END AS
rollover_value
FROM readings
)
)
);
+--------+
| result |
+--------+
| 2.0 |
+--------+
1 row(s) fetched.
Elapsed 0.006 seconds.
```
### Expected behavior
Return a better error message, something like
```
Arrow error: Invalid argument error: __common_expr_2 is a reserved
DataFusion column name, please use another name
```
### 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]