pub fn flat_map<I, C, L>(
        &self,
        key_val: Option<(Vec<MirScalarExpr>, Row)>,
        constructor: C,
    ) -> (
        timely::dataflow::Stream<S, I::Item>,
        Collection<S, DataflowError, Diff>,
    )
    where
        I: IntoIterator,
        I::Item: Data,
        C: FnOnce(Option<Permutation>) -> L,
        L: for<'a, 'b> FnMut(&'a [&'b RefOrMut<'b, Row>], &'a S::Timestamp, &'a Diff) -> I
            + 'static,
    {
        // If `key_val` is set, and we have the arrangement by that key, we should
        // use that arrangement.
        if let Some((key, val)) = key_val {
            if let Some(flavor) = self.arrangement(&key) {
                return flavor.flat_map(Some(val), constructor);
            }
        }

        // No key, or a key but no matching arrangement (the latter would likely imply
        // an error in the contract between key-production and available arrangements).
        // We should now prefer to use an arrangement if available (avoids allocation),
        // and resort to using a collection if not available (copies all rows).
        if let Some(flavor) = self.arranged.values().next() {
            flavor.flat_map(None, constructor)
        } else {
            use timely::dataflow::operators::Map;
            let (oks, errs) = self.as_collection();
            let mut logic = constructor(None);
            (
                oks.inner
                    .flat_map(move |(mut v, t, d)| logic(&[&RefOrMut::Mut(&mut v)], &t, &d)),
                errs,
            )
        }
    }
/// Constructs and applies logic to elements of a collection and returns the results.
///
/// `constructor` takes a permutation and produces the logic to apply on elements. The logic
/// conceptually receives `(&Row, &Row)` pairs in the form of a slice. Only after borrowing
/// the elements and applying the permutation the datums will be in the expected order.
///
/// If `key_val` is set, this is a promise that `logic` will produce no results on
/// records for which the key does not evaluate to the value. This is used when we
/// have an arrangement by that key to leap directly to exactly those records.
/// It is important that `logic` still guard against data that does not satisfy
/// this constraint, as this method does not statically know that it will have
/// that arrangement.
Constructs and applies logic to elements of a collection and returns the results.
`constructor` takes a permutation and produces the logic to apply on elements. The logic
conceptually receives `(&Row, &Row)` pairs in the form of a slice. Only after borrowing
the elements and applying the permutation the datums will be in the expected order.

If `key_val` is set, this is a promise that `logic` will produce no results on
records for which the key does not evaluate to the value. This is used when we
have an arrangement by that key to leap directly to exactly those records.
It is important that `logic` still guard against data that does not satisfy
this constraint, as this method does not statically know that it will have
that arrangement.
Constructs and applies logic to elements of a collection and returns the results . ` constructor ` takes a permutation and produces the logic to apply on elements . The logic conceptually receives ` ( &Row &Row ) ` pairs in the form of a slice . Only after borrowing the elements and applying the permutation the datums will be in the expected order . If ` key_val ` is set this is a promise that ` logic ` will produce no results on records for which the key does not evaluate to the value . This is used when we have an arrangement by that key to leap directly to exactly those records . It is important that ` logic ` still guard against data that does not satisfy this constraint as this method does not statically know that it will have that arrangement .
pub fn flat_map<I, C, L>(
        &self,
        key_val: Option<(Vec<MirScalarExpr>, Row)>,
        constructor: C,
    ) -> (
        timely::dataflow::Stream<S, I::Item>,
        Collection<S, DataflowError, Diff>,
    )
    where
        I: IntoIterator,
        I::Item: Data,
        C: FnOnce(Option<Permutation>) -> L,
        L: for<'a, 'b> FnMut(&'a [&'b RefOrMut<'b, Row>], &'a S::Timestamp, &'a Diff) -> I
            + 'static,
    {
        // If `key_val` is set, and we have the arrangement by that key, we should
        // use that arrangement.
        if let Some((key, val)) = key_val {
            if let Some(flavor) = self.arrangement(&key) {
                return flavor.flat_map(Some(val), constructor);
            }
        }
        // No key, or a key but no matching arrangement (the latter would likely imply
        // an error in the contract between key-production and available arrangements).
        // We should now prefer to use an arrangement if available (avoids allocation),
        // and resort to using a collection if not available (copies all rows).
        if let Some(flavor) = self.arranged.values().next() {
            flavor.flat_map(None, constructor)
        } else {
            use timely::dataflow::operators::Map;
            let (oks, errs) = self.as_collection();
            let mut logic = constructor(None);
            (
                oks.inner
                    .flat_map(move |(mut v, t, d)| logic(&[&RefOrMut::Mut(&mut v)], &t, &d)),
                errs,
            )
        }
    }
pub fn flat_map < I , C , L > ( & self , key_val : Option < ( Vec < MirScalarExpr > , Row ) > , constructor : C , ) -> ( timely :: dataflow :: Stream < S , I :: Item > , Collection < S , DataflowError , Diff > , ) where I : IntoIterator , I :: Item : Data , C : FnOnce ( Option < Permutation > ) -> L , L : for < ' a , ' b > FnMut ( & ' a [ & ' b RefOrMut < ' b , Row > ] , & ' a S :: Timestamp , & ' a Diff ) -> I + ' static , { // If `key_val` is set, and we have the arrangement by that key, we should // use that arrangement. if let Some ( ( key , val ) ) = key_val { if let Some ( flavor ) = self . arrangement ( & key ) { return flavor . flat_map ( Some ( val ) , constructor ) ; } } // No key, or a key but no matching arrangement (the latter would likely imply // an error in the contract between key-production and available arrangements). // We should now prefer to use an arrangement if available (avoids allocation), // and resort to using a collection if not available (copies all rows). if let Some ( flavor ) = self . arranged . values ( ) . next ( ) { flavor . flat_map ( None , constructor ) } else { use timely :: dataflow :: operators :: Map ; let ( oks , errs ) = self . as_collection ( ) ; let mut logic = constructor ( None ) ; ( oks . inner . flat_map ( move | ( mut v , t , d ) | logic ( & [ & RefOrMut :: Mut ( & mut v ) ] , & t , & d ) ) , errs , ) } }
Constructs and applies logic to elements of a collection and returns the results.
Constructs and applies logic to elements of a collection and returns the results .
&self
key_val
Option<(Vec<MirScalarExpr>, Row)>
constructor
C
&self
key_val
Option<(Vec<MirScalarExpr>, Row)>
constructor
C