(
&self,
group_key: &Vec<MirScalarExpr>,
expected_group_size: &Option<u64>,
input: CardinalityEstimate,
)
| 1803 | } |
| 1804 | |
| 1805 | fn reduce( |
| 1806 | &self, |
| 1807 | group_key: &Vec<MirScalarExpr>, |
| 1808 | expected_group_size: &Option<u64>, |
| 1809 | input: CardinalityEstimate, |
| 1810 | ) -> CardinalityEstimate { |
| 1811 | // TODO(mgree): if no `group_key` is present, we can do way better |
| 1812 | |
| 1813 | if let Some(expected_group_size) = expected_group_size { |
| 1814 | // if expected group size is 0, treat it as 1 (to avoid DBZ/+inf estimates) |
| 1815 | let group_size = u64::max(*expected_group_size, 1); |
| 1816 | input / f64::cast_lossy(group_size) |
| 1817 | } else if group_key.is_empty() { |
| 1818 | CardinalityEstimate::from(1.0) |
| 1819 | } else { |
| 1820 | // in the worst case, every row is its own group |
| 1821 | input |
| 1822 | } |
| 1823 | } |
| 1824 | |
| 1825 | fn topk( |
| 1826 | &self, |
no test coverage detected