kosiew commented on code in PR #22309:
URL: https://github.com/apache/datafusion/pull/22309#discussion_r3303380588
##########
datafusion/expr-common/src/interval_arithmetic.rs:
##########
@@ -4157,6 +4157,16 @@ mod tests {
ScalarValue::TimestampNanosecond(Some(2_000_000_000), None),
)?;
assert_eq!(interval.cardinality().unwrap(), 1_000_000_001);
+ Ok(())
+ }
+
+ #[test]
+ fn test_cardinality_full_i64_range_does_not_overflow() -> Result<()> {
Review Comment:
Nice catch on the overflow edge case. One additional regression test that
could be helpful would be a sibling case for
`ScalarValue::UInt64(Some(0))..=ScalarValue::UInt64(Some(u64::MAX))` returning
`None`.
The fix applies more generally to any integer or temporal range where
`distance == u64::MAX`, so adding the unsigned boundary case would help
document that broader invariant and guard against future regressions there as
well.
--
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]