pub fn find_bound_expr(
        &self,
        expr: &MirScalarExpr,
        bound_inputs: &[usize],
        equivalences: &[Vec<MirScalarExpr>],
    ) -> Option<MirScalarExpr> {
        if let Some(equivalence) = equivalences.iter().find(|equivs| equivs.contains(expr)) {
            if let Some(bound_expr) = equivalence
                .iter()
                .find(|expr| self.lookup_inputs(expr).all(|i| bound_inputs.contains(&i)))
            {
                return Some(bound_expr.clone());
            }
        }
        None
    }
/// 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 repr::{Datum, ColumnType, RelationType, ScalarType};
/// use expr::{JoinInputMapper, MirRelationExpr, MirScalarExpr};
///
/// // A two-column schema common to each of the three inputs
/// let schema = RelationType::new(vec![
///   ScalarType::Int32.nullable(false),
///   ScalarType::Int32.nullable(false),
/// ]);
///
/// // the specific data are not important here.
/// let data = vec![Datum::Int32(0), Datum::Int32(1)];
/// let input0 = MirRelationExpr::constant(vec![data.clone()], schema.clone());
/// let input1 = MirRelationExpr::constant(vec![data.clone()], schema.clone());
/// let input2 = MirRelationExpr::constant(vec![data.clone()], schema.clone());
///
/// // [input0(#0) = input2(#1)], [input0(#1) = input1(#0) = input2(#0)]
/// let equivalences = vec![
///   vec![MirScalarExpr::Column(0), MirScalarExpr::Column(5)],
///   vec![MirScalarExpr::Column(1), MirScalarExpr::Column(2), MirScalarExpr::Column(4)],
/// ];
///
/// let input_mapper = JoinInputMapper::new(&[input0, input1, input2]);
/// assert_eq!(
///   Some(MirScalarExpr::Column(4)),
///   input_mapper.find_bound_expr(&MirScalarExpr::Column(2), &[2], &equivalences)
/// );
/// assert_eq!(
///   None,
///   input_mapper.find_bound_expr(&MirScalarExpr::Column(0), &[1], &equivalences)
/// );
/// ```
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`
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 `
pub fn find_bound_expr(
        &self,
        expr: &MirScalarExpr,
        bound_inputs: &[usize],
        equivalences: &[Vec<MirScalarExpr>],
    ) -> Option<MirScalarExpr> {
        if let Some(equivalence) = equivalences.iter().find(|equivs| equivs.contains(expr)) {
            if let Some(bound_expr) = equivalence
                .iter()
                .find(|expr| self.lookup_inputs(expr).all(|i| bound_inputs.contains(&i)))
            {
                return Some(bound_expr.clone());
            }
        }
        None
    }
pub fn find_bound_expr ( & self , expr : & MirScalarExpr , bound_inputs : & [ usize ] , equivalences : & [ Vec < MirScalarExpr > ] , ) -> Option < MirScalarExpr > { if let Some ( equivalence ) = equivalences . iter ( ) . find ( | equivs | equivs . contains ( expr ) ) { if let Some ( bound_expr ) = equivalence . iter ( ) . find ( | expr | self . lookup_inputs ( expr ) . all ( | i | bound_inputs . contains ( & i ) ) ) { return Some ( bound_expr . clone ( ) ) ; } } None }
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`
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 `
&self
expr
&MirScalarExpr
bound_inputs
&[usize]
equivalences
&[Vec<MirScalarExpr>]
&self
expr
&MirScalarExpr
bound_inputs
&[usize]
equivalences
&[Vec<MirScalarExpr>]
examples
```
use repr::{Datum, ColumnType, RelationType, ScalarType};
use expr::{JoinInputMapper, MirRelationExpr, MirScalarExpr}.

A two-column schema common to each of the three inputs
let schema = RelationType::new(vec![
ScalarType::Int32.nullable(false),
ScalarType::Int32.nullable(false),
]).

the specific data are not important here.
let data = vec![Datum::Int32(0), Datum::Int32(1)];
let input0 = MirRelationExpr::constant(vec![data.clone()], schema.clone());
let input1 = MirRelationExpr::constant(vec![data.clone()], schema.clone());
let input2 = MirRelationExpr::constant(vec![data.clone()], schema.clone()).

[input0(#0) = input2(#1)], [input0(#1) = input1(#0) = input2(#0)]
let equivalences = vec![
vec![MirScalarExpr::Column(0), MirScalarExpr::Column(5)],
vec![MirScalarExpr::Column(1), MirScalarExpr::Column(2), MirScalarExpr::Column(4)],
].

let input_mapper = JoinInputMapper::new(&[input0, input1, input2]);
assert_eq!(
Some(MirScalarExpr::Column(4)),
input_mapper.find_bound_expr(&MirScalarExpr::Column(2), &[2], &equivalences)
);
assert_eq!(
None,
input_mapper.find_bound_expr(&MirScalarExpr::Column(0), &[1], &equivalences)
);
```
` ` ` use repr :: { Datum ColumnType RelationType ScalarType } ; use expr :: { JoinInputMapper MirRelationExpr MirScalarExpr } . A two - column schema common to each of the three inputs let schema = RelationType :: new ( vec! [ ScalarType :: Int32 . nullable ( false ) ScalarType :: Int32 . nullable ( false ) ] ) . the specific data are not important here . let data = vec! [ Datum :: Int32 ( 0 ) Datum :: Int32 ( 1 ) ] ; let input0 = MirRelationExpr :: constant ( vec! [ data . clone () ] schema . clone () ) ; let input1 = MirRelationExpr :: constant ( vec! [ data . clone () ] schema . clone () ) ; let input2 = MirRelationExpr :: constant ( vec! [ data . clone () ] schema . clone () ) . [ input0 ( #0 ) = input2 ( #1 ) ] [ input0 ( #1 ) = input1 ( #0 ) = input2 ( #0 ) ] let equivalences = vec! [ vec! [ MirScalarExpr :: Column ( 0 ) MirScalarExpr :: Column ( 5 ) ] vec! [ MirScalarExpr :: Column ( 1 ) MirScalarExpr :: Column ( 2 ) MirScalarExpr :: Column ( 4 ) ] ] . let input_mapper = JoinInputMapper :: new ( & [ input0 input1 input2 ] ) ; assert_eq! ( Some ( MirScalarExpr :: Column ( 4 )) input_mapper . find_bound_expr ( &MirScalarExpr :: Column ( 2 ) & [ 2 ] &equivalences ) ) ; assert_eq! ( None input_mapper . find_bound_expr ( &MirScalarExpr :: Column ( 0 ) & [ 1 ] &equivalences ) ) ; ` ` `