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

Function round_decimal_or_zero

datafusion/functions/src/math/round.rs:708–724  ·  view source on GitHub ↗
(
    value: V,
    precision: u8,
    input_scale: i8,
    output_scale: i8,
    decimal_places: i32,
)

Source from the content-addressed store, hash-verified

706}
707
708fn round_decimal_or_zero<V: ArrowNativeTypeOp>(
709 value: V,
710 precision: u8,
711 input_scale: i8,
712 output_scale: i8,
713 decimal_places: i32,
714) -> Result<V, ArrowError> {
715 if let Some(dp) =
716 normalize_decimal_places_for_decimal(decimal_places, precision, input_scale)
717 {
718 round_decimal(value, input_scale, output_scale, dp)
719 } else {
720 V::from_usize(0).ok_or_else(|| {
721 ArrowError::ComputeError("Internal error: could not create constant 0".into())
722 })
723 }
724}
725
726#[cfg(test)]
727mod test {

Callers 2

invoke_with_argsMethod · 0.85
round_columnarFunction · 0.85

Calls 3

round_decimalFunction · 0.70
intoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…