fn interval_mul_f64(
interval: IntervalMonthDayNano,
factor: f64,
) -> Result<IntervalMonthDayNano, ArrowError>Expand description
Multiplies an IntervalMonthDayNano by an f64, mirroring DuckDB’s
interval_t layout of months, days, and a sub-day component (nanoseconds in
Arrow, microseconds in DuckDB).
https://github.com/duckdb/duckdb/blob/21aca0424f1faf78b593b1e6fbfdd4846624c987/src/include/duckdb/common/types/interval.hpp#L24-L27
Algorithm:
- use checked integer multiplication when
factorfits ini64(early return). - multiply months and days separately
- cascade remainders: convert fractional months to days using 30 days per month, then fractional days to a sub-day value using 24 hours per day.
- combine the cascaded remainder with the scaled input nanoseconds and round ties-to-even at nanosecond precision.
- return an overflow error if any output component is out of range.