You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "appletreeisyellow (via GitHub)" <gi...@apache.org> on 2026/08/26 15:08:35 UTC
[I] Better error when the query contains reserved names [datafusion]
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: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Better error when the query contains reserved names [datafusion]
Posted by "dharanad (via GitHub)" <gi...@apache.org>.
dharanad commented on issue #24701:
URL: https://github.com/apache/datafusion/issues/24701#issuecomment-5428399440
take
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Better error when the query contains reserved names [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #24701:
URL: https://github.com/apache/datafusion/issues/24701#issuecomment-5428054288
I think this has a clear reproducer and would be a good first issue.
The reproducer should be a SLT test
then I would recommend trying to generate an error, probably in the `datafusion/datafusion/optimizer/src/common_subexpr_eliminate.rs` module, with a better message
The reason to put it in the same module (rather than in the sql planner for example) is
1. So it doesn't drift
2. Doesn't trigger if a user is not using the common_subexpr_eliminate pass
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Better error when the query contains reserved names [datafusion]
Posted by "kosiew (via GitHub)" <gi...@apache.org>.
kosiew closed issue #24701: Better error when the query contains reserved names
URL: https://github.com/apache/datafusion/issues/24701
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org