You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "myandpr (via GitHub)" <gi...@apache.org> on 2026/03/17 12:19:55 UTC
[I] Wrapped unary negation under IS NULL can escape analyzer type validation [datafusion]
myandpr opened a new issue, #20988:
URL: https://github.com/apache/datafusion/issues/20988
### Describe the bug
An invalid unary negation expression can escape analyzer/type coercion validation when wrapped by `IS NULL`.
For example, `SELECT * FROM (SELECT 1) WHERE ((-'a') IS NULL)` is accepted during planning and optimization, even though `-'a'` is not a valid negation expression.
### To Reproduce
```rust
#[tokio::test]
async fn wrapped_negation_is_accepted() {
let ctx = SessionContext::new();
let plan = ctx
.sql("SELECT * FROM (SELECT 1) WHERE ((-'a') IS NULL)")
.await
.unwrap()
.into_optimized_plan();
assert!(plan.is_ok());
}
```
I also verified that the same query executes successfully and returns Ok([]) before the fix.
### Expected behavior
Invalid wrapped negation expressions such as (-'a') IS NULL should be rejected during analyzer/type coercion, rather than being accepted.
### Additional context
This appears to be a gap in expression validation for `Expr::Negative`.
--
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] Wrapped unary negation under IS NULL can escape analyzer type validation [datafusion]
Posted by "myandpr (via GitHub)" <gi...@apache.org>.
myandpr closed issue #20988: Wrapped unary negation under IS NULL can escape analyzer type validation
URL: https://github.com/apache/datafusion/issues/20988
--
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] Wrapped unary negation under IS NULL can escape analyzer type validation [datafusion]
Posted by "myandpr (via GitHub)" <gi...@apache.org>.
myandpr commented on issue #20988:
URL: https://github.com/apache/datafusion/issues/20988#issuecomment-4074574796
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