kumarUjjawal commented on code in PR #19563:
URL: https://github.com/apache/datafusion/pull/19563#discussion_r2658920235


##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -251,6 +340,11 @@ impl PhysicalExpr for BinaryExpr {
         match self.op {
             Operator::Plus if self.fail_on_overflow => return apply(&lhs, 
&rhs, add),
             Operator::Plus => return apply(&lhs, &rhs, add_wrapping),
+            // Special case: Date - Date returns Int64 (days difference)
+            // This aligns with PostgreSQL, DuckDB, and MySQL behavior
+            Operator::Minus if is_date_minus_date(&left_data_type, 
&right_data_type) => {

Review Comment:
   Date subtraction  will always fit in Int64 without overflow risk so comment 
might be suffiecient.  I can add a check for that if your prefer.



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