neilconway commented on code in PR #20383:
URL: https://github.com/apache/datafusion/pull/20383#discussion_r2813019236
##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -697,6 +716,13 @@ pub fn cast_subquery(subquery: Subquery, cast_to_type:
&DataType) -> Result<Subq
})
}
+/// Determine whether the given data type `dt` supports the negation operator.
+///
+/// Negation is supported for numeric, interval, timestamp types, and null.
+pub fn is_negatable(dt: &DataType) -> bool {
+ dt.is_numeric() || is_interval(dt) || is_timestamp(dt) || dt.is_null()
Review Comment:
When creating the physical expr, we don't allow unsigned numerics
https://github.com/apache/datafusion/blob/7d217b1ec3bd4d447961e84bc3fe7f7708546b2d/datafusion/physical-expr/src/expressions/negative.rs#L195-L199
Seems like these two checks ought to be consistent with one another.
##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -697,6 +716,13 @@ pub fn cast_subquery(subquery: Subquery, cast_to_type:
&DataType) -> Result<Subq
})
}
+/// Determine whether the given data type `dt` supports the negation operator.
+///
+/// Negation is supported for numeric, interval, timestamp types, and null.
+pub fn is_negatable(dt: &DataType) -> bool {
Review Comment:
Why is this `pub`?
--
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]