kosiew commented on code in PR #22823:
URL: https://github.com/apache/datafusion/pull/22823#discussion_r3456626584


##########
datafusion/functions/src/datetime/date_bin.rs:
##########
@@ -570,7 +572,7 @@ fn date_bin_impl(
     ) -> Option<i64> {
         let scale = timestamp_scale::<T>();
         value
-            .and_then(|val| val.checked_mul(scale))
+            .and_then(|value| checked_scale_to_nanos(value, scale).ok())

Review Comment:
   The value is centralizing the checked source/origin scaling invariant, not 
surfacing the helper error on source rows.
   
   Source scaling intentionally converts `checked_scale_to_nanos(...).ok()` to 
`NULL` and tests for row overflow. Origin scaling still uses `?`, so invalid 
origin scaling remains an error. 
   Keeping the `.ok()` at the call site makes that policy explicit while 
avoiding duplicated `checked_mul(scale)` paths.
   



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