fn determine_keys_priors(
    relation: usize,
    constraints: &[Vec<(usize, usize)>],
    current_attributes: &[(usize, usize)],
)
-> (Vec<usize>, Vec<usize>)
{
    // The fields in `sources[join_idx]` that should be keys are those
    // that share an equality constraint with an element of `attributes`.
    // For each key, we should capture the associated `attributes` entry
    // so that we can easily prepare the keys of the `delta` stream.
    let mut keys = Vec::new();
    let mut priors = Vec::new();
    for constraint in constraints.iter() {

        // If there is an intersection between `constraint` and `current_attributes`,
        // we should capture the position in `current_attributes` and emit all of the
        // attributes for `relation`.
        if let Some(prior) = current_attributes.iter().position(|x| constraint.contains(x)) {
            for &(attr, index) in constraint.iter() {
                if index == relation {
                    keys.push(attr);
                    priors.push(prior);
                }
            }
        }
    }

    (keys, priors)
}
Identifies keys and values for a join.

The result is a sequence, for each
interactive/src/plan/sfw.rs