(&self, tf: &TableFunc, input: CardinalityEstimate)
| 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, |
no test coverage detected