fn lower_join(
        &mut self,
        get_outer: expr::MirRelationExpr,
        outer_column_map: &ColumnMap,
        quantifiers: &QuantifierSet,
        id_gen: &mut IdGen,
    ) -> (expr::MirRelationExpr, ColumnMap) {
        if let expr::MirRelationExpr::Get { .. } = &get_outer {
        } else {
            panic!(
                "get_outer: expected a MirRelationExpr::Get, found {:?}",
                get_outer
            );
        }

        let outer_arity = get_outer.arity();

        let join_inputs = quantifiers
            .iter()
            .map(|q_id| self.lower_quantifier(*q_id, get_outer.clone(), outer_column_map, id_gen))
            .collect_vec();

        let join = if join_inputs.len() == 1 {
            join_inputs.into_iter().next().unwrap()
        } else {
            Self::join_on_prefix(join_inputs, outer_arity)
        };

        // Generate a column map with the projection of the join plus the
        // columns from the outer context.
        let mut column_map = outer_column_map.clone();
        let mut next_column = outer_arity;
        for q_id in quantifiers.iter() {
            let input_box = self.model.get_quantifier(*q_id).input_box;
            let arity = self.model.get_box(input_box).columns.len();
            for c in 0..arity {
                column_map.insert(
                    ColumnReference {
                        quantifier_id: *q_id,
                        position: c,
                    },
                    next_column + c,
                );
            }

            next_column += arity;
        }

        (join, column_map)
    }
/// Generates a join among the result of applying the outer relation to the given
/// quantifiers. Returns a relation and a map of column references that can be
/// used to lower expressions that sit directly on top of the join.
///
/// The quantifiers are joined on the columns of the outer relation.
/// TODO(asenac) Since decorrelation is not yet supported the outer relation is
/// currently always the join identity, so the result of this method is always
/// a cross-join of the given quantifiers, which makes part of this code untesteable
/// at the moment.
Generates a join among the result of applying the outer relation to the given
quantifiers. Returns a relation and a map of column references that can be
used to lower expressions that sit directly on top of the join.

The quantifiers are joined on the columns of the outer relation.
TODO(asenac) Since decorrelation is not yet supported the outer relation is
currently always the join identity, so the result of this method is always
a cross-join of the given quantifiers, which makes part of this code untesteable
at the moment.
Generates a join among the result of applying the outer relation to the given quantifiers . Returns a relation and a map of column references that can be used to lower expressions that sit directly on top of the join . The quantifiers are joined on the columns of the outer relation . TODO ( asenac ) Since decorrelation is not yet supported the outer relation is currently always the join identity so the result of this method is always a cross - join of the given quantifiers which makes part of this code untesteable at the moment .
fn lower_join(
        &mut self,
        get_outer: expr::MirRelationExpr,
        outer_column_map: &ColumnMap,
        quantifiers: &QuantifierSet,
        id_gen: &mut IdGen,
    ) -> (expr::MirRelationExpr, ColumnMap) {
        if let expr::MirRelationExpr::Get { .. } = &get_outer {
        } else {
            panic!(
                "get_outer: expected a MirRelationExpr::Get, found {:?}",
                get_outer
            );
        }
        let outer_arity = get_outer.arity();
        let join_inputs = quantifiers
            .iter()
            .map(|q_id| self.lower_quantifier(*q_id, get_outer.clone(), outer_column_map, id_gen))
            .collect_vec();
        let join = if join_inputs.len() == 1 {
            join_inputs.into_iter().next().unwrap()
        } else {
            Self::join_on_prefix(join_inputs, outer_arity)
        };
        // Generate a column map with the projection of the join plus the
        // columns from the outer context.
        let mut column_map = outer_column_map.clone();
        let mut next_column = outer_arity;
        for q_id in quantifiers.iter() {
            let input_box = self.model.get_quantifier(*q_id).input_box;
            let arity = self.model.get_box(input_box).columns.len();
            for c in 0..arity {
                column_map.insert(
                    ColumnReference {
                        quantifier_id: *q_id,
                        position: c,
                    },
                    next_column + c,
                );
            }
            next_column += arity;
        }
        (join, column_map)
    }
fn lower_join ( & mut self , get_outer : expr :: MirRelationExpr , outer_column_map : & ColumnMap , quantifiers : & QuantifierSet , id_gen : & mut IdGen , ) -> ( expr :: MirRelationExpr , ColumnMap ) { if let expr :: MirRelationExpr :: Get { .. } = & get_outer { } else { panic ! ( " " get_outer ) ; } let outer_arity = get_outer . arity ( ) ; let join_inputs = quantifiers . iter ( ) . map ( | q_id | self . lower_quantifier ( * q_id , get_outer . clone ( ) , outer_column_map , id_gen ) ) . collect_vec ( ) ; let join = if join_inputs . len ( ) == 1 { join_inputs . into_iter ( ) . next ( ) . unwrap ( ) } else { Self :: join_on_prefix ( join_inputs , outer_arity ) } ; // Generate a column map with the projection of the join plus the // columns from the outer context. let mut column_map = outer_column_map . clone ( ) ; let mut next_column = outer_arity ; for q_id in quantifiers . iter ( ) { let input_box = self . model . get_quantifier ( * q_id ) . input_box ; let arity = self . model . get_box ( input_box ) . columns . len ( ) ; for c in 0 .. arity { column_map . insert ( ColumnReference { quantifier_id : * q_id , position : c , } , next_column + c , ) ; } next_column += arity ; } ( join , column_map ) }
Generates a join among the result of applying the outer relation to the given
quantifiers.
Generates a join among the result of applying the outer relation to the given quantifiers .
&mut self
get_outer
expr::MirRelationExpr
outer_column_map
&ColumnMap
quantifiers
&QuantifierSet
id_gen
&mut IdGen
&mut self
get_outer
expr::MirRelationExpr
outer_column_map
&ColumnMap
quantifiers
&QuantifierSet
id_gen
&mut IdGen