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

Method flat_map

src/transform/src/analysis.rs:1595–1610  ·  view source on GitHub ↗
(&self, tf: &TableFunc, input: CardinalityEstimate)

Source from the content-addressed store, hash-verified

1593 // We split it up into functions to make it all a bit more tractable to work with.
1594 impl Cardinality {
1595 fn flat_map(&self, tf: &TableFunc, input: CardinalityEstimate) -> CardinalityEstimate {
1596 match tf {
1597 TableFunc::Wrap { types, width } => {
1598 // DBZ is harmless (produces inf, empty estimate), but still a broken invariant
1599 if *width == 0 {
1600 error!("cardinality estimation encountered TableFunc::Wrap with width 0");
1601 }
1602
1603 input * (f64::cast_lossy(types.len()) / f64::cast_lossy(*width))
1604 }
1605 _ => {
1606 // TODO(mgree) what explosion factor should we make up?
1607 input * CardinalityEstimate::from(4.0)
1608 }
1609 }
1610 }
1611
1612 fn predicate(
1613 &self,

Callers 15

registerMethod · 0.45
apply_leMethod · 0.45
newMethod · 0.45
as_of_untilFunction · 0.45
commit_atMethod · 0.45
assert_eqMethod · 0.45
expect_snapshotMethod · 0.45
flat_map_fallibleMethod · 0.45
consolidate_named_ifMethod · 0.45
consolidate_namedMethod · 0.45

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected