MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / sum_numeric

Function sum_numeric

src/expr/src/relation/func.rs:176–193  ·  view source on GitHub ↗
(datums: I)

Source from the content-addressed store, hash-verified

174}
175
176fn sum_numeric<'a, I>(datums: I) -> Datum<'a>
177where
178 I: IntoIterator<Item = Datum<'a>>,
179{
180 let mut cx = numeric::cx_datum();
181 let mut sum = Numeric::zero();
182 let mut empty = true;
183 for d in datums {
184 if !d.is_null() {
185 empty = false;
186 cx.add(&mut sum, &d.unwrap_numeric().0);
187 }
188 }
189 match empty {
190 true => Datum::Null,
191 false => Datum::from(sum),
192 }
193}
194
195fn count<'a, I>(datums: I) -> Datum<'a>
196where

Callers 1

eval_datumsMethod · 0.85

Calls 4

cx_datumFunction · 0.85
unwrap_numericMethod · 0.80
is_nullMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected