alamb commented on code in PR #21288:
URL: https://github.com/apache/datafusion/pull/21288#discussion_r3030504399


##########
datafusion/sql/src/expr/unary_op.rs:
##########
@@ -32,9 +35,37 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
         planner_context: &mut PlannerContext,
     ) -> Result<Expr> {
         match op {
-            UnaryOperator::Not => Ok(Expr::Not(Box::new(
-                self.sql_expr_to_logical_expr(expr, schema, planner_context)?,
-            ))),
+            UnaryOperator::Not => {
+                let operand =
+                    self.sql_expr_to_logical_expr(expr, schema, 
planner_context)?;

Review Comment:
   This checking is normally done as part of analysis (not the sql planner) 
(aka in an Analyzer rule) -- if we put it in sql planning then it won't apply 
to queries that don't come from SQL.



##########
datafusion/sql/tests/sql_integration.rs:
##########
@@ -840,16 +840,14 @@ fn select_filter_cannot_use_alias() {
 
 #[test]
 fn select_neg_filter() {
+    // NOT requires a boolean expression; applying it to a Utf8 column is an 
error

Review Comment:
   Can we also ensure we have test coverage for planning an actual valid `not` 
expression?



-- 
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]

Reply via email to