Takes an expression in the global context and looks in `equivalences` for an equivalent expression (also expressed in the global context) that belongs to one or more of the inputs in `bound_inputs` # Examples ``` use mz_repr::{Datum, ReprColumnType, ReprRelationType, ReprScalarType}; use mz_expr::{JoinInputMapper, MirRelationExpr, MirScalarExpr}; // A two-column schema common to each of the thr
(
&self,
expr: &C,
bound_inputs: &[usize],
equivalences: &[Vec<C>],
)
| 294 | /// ); |
| 295 | /// ``` |
| 296 | pub fn find_bound_expr<C: Columns + Clone + Eq>( |
| 297 | &self, |
| 298 | expr: &C, |
| 299 | bound_inputs: &[usize], |
| 300 | equivalences: &[Vec<C>], |
| 301 | ) -> Option<C> { |
| 302 | if let Some(equivalence) = equivalences.iter().find(|equivs| equivs.contains(expr)) { |
| 303 | if let Some(bound_expr) = equivalence |
| 304 | .iter() |
| 305 | .find(|expr| self.lookup_inputs(*expr).all(|i| bound_inputs.contains(&i))) |
| 306 | { |
| 307 | return Some(bound_expr.clone()); |
| 308 | } |
| 309 | } |
| 310 | None |
| 311 | } |
| 312 | |
| 313 | /// Try to rewrite `expr` from the global context so that all the |
| 314 | /// columns point to the `index`th input by replacing subexpressions with their |
no test coverage detected