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

Method multiply

datafusion/common/src/stats.rs:180–193  ·  view source on GitHub ↗

Calculates the multiplication of two (possibly inexact) [`usize`] values, conservatively propagating exactness information. If one of the input values is [`Precision::Absent`], the result is `Absent` too.

(&self, other: &Precision<usize>)

Source from the content-addressed store, hash-verified

178 /// conservatively propagating exactness information. If one of the input
179 /// values is [`Precision::Absent`], the result is `Absent` too.
180 pub fn multiply(&self, other: &Precision<usize>) -> Precision<usize> {
181 match (self, other) {
182 (Precision::Exact(a), Precision::Exact(b)) => a.checked_mul(*b).map_or_else(
183 || Precision::Inexact(a.saturating_mul(*b)),
184 Precision::Exact,
185 ),
186 (Precision::Inexact(a), Precision::Exact(b))
187 | (Precision::Exact(a), Precision::Inexact(b))
188 | (Precision::Inexact(a), Precision::Inexact(b)) => {
189 Precision::Inexact(a.saturating_mul(*b))
190 }
191 (_, _) => Precision::Absent,
192 }
193 }
194
195 /// Return the estimate of applying a filter with estimated selectivity
196 /// `selectivity` to this Precision. A selectivity of `1.0` means that all

Callers 4

project_statisticsMethod · 0.80
stats_cartesian_productFunction · 0.80
with_statisticsMethod · 0.80

Calls 2

mul_checkedMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected