MCPcopy Create free account
hub / github.com/apache/datafusion / mul_bounds

Function mul_bounds

datafusion/expr-common/src/interval_arithmetic.rs:1121–1137  ·  view source on GitHub ↗

Helper function used for multiplying the end-point values of intervals. Caution:** This function contains multiple calls to `unwrap()`, and may return non-standardized interval bounds. Therefore, it should be used with caution. Currently, it is used in contexts where the `DataType` (`dt`) is validated prior to calling this function, and the following interval creation is standardized with `Interv

(
    dt: &DataType,
    lhs: &ScalarValue,
    rhs: &ScalarValue,
)

Source from the content-addressed store, hash-verified

1119/// (`dt`) is validated prior to calling this function, and the following
1120/// interval creation is standardized with `Interval::new`.
1121fn mul_bounds<const UPPER: bool>(
1122 dt: &DataType,
1123 lhs: &ScalarValue,
1124 rhs: &ScalarValue,
1125) -> ScalarValue {
1126 if lhs.is_null() || rhs.is_null() {
1127 return ScalarValue::try_from(dt).unwrap();
1128 }
1129
1130 match dt {
1131 DataType::Float64 | DataType::Float32 => {
1132 alter_fp_rounding_mode::<UPPER, _>(lhs, rhs, |lhs, rhs| lhs.mul_checked(rhs))
1133 }
1134 _ => lhs.mul_checked(rhs),
1135 }
1136 .unwrap_or_else(|_| handle_overflow::<UPPER>(dt, Operator::Multiply, lhs, rhs))
1137}
1138
1139/// Helper function used for dividing the end-point values of intervals.
1140///

Callers

nothing calls this directly

Calls 2

mul_checkedMethod · 0.80
is_nullMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…