You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The negation operator escapes type checking at logical planning phase #20355
#[tokio::test]asyncfntest_unary_negation_on_string_error() -> Result<()>{let ctx = SessionContext::new();let res = ctx.sql("SELECT -'a';").await;assert!(res.is_err());Ok(())}
Negation operator can't work on Utf8 should be reported at planning phase, but this test failed.
Root Cause
It invokes Expr::to_field to check types and get filed of each expressions in query while generating logical plan . However, in the Expr::Negative bench it only returns the field of its inner expression:
Verified on current main (1e58928): this no longer reproduces. SELECT -'a'; is now rejected during planning with Error during planning: Unary operator '-' only supports signed numeric, interval and timestamp types — exactly the behavior requested in the issue. Suggest closing.
Activity
Acfboy commentedon Feb 14, 2026
take
u70b3 commentedon Jul 20, 2026
Verified on current main (1e58928): this no longer reproduces.
SELECT -'a';is now rejected during planning withError during planning: Unary operator '-' only supports signed numeric, interval and timestamp types— exactly the behavior requested in the issue. Suggest closing.