26 lines
971 B
Rust
Raw Normal View History

//! Semijoin and natural join over binding relations.
//!
//! Both operators join on the shared column names of their inputs (the
//! "overlapping variables" in Datalog terms).
//!
//! - [`semijoin`] keeps rows of `left` whose shared-column values appear in
//! `right`. Output columns are `left.columns` unchanged.
//! - [`natural_join`] keeps every pair `(l, r)` that agrees on shared columns,
//! emitting one row with the union of columns. Output column order is
//! `left.columns` followed by `right.columns` minus the shared ones.
use crate::relation::Relation;
#[must_use]
pub fn semijoin(_left: &Relation, _right: &Relation) -> Relation {
todo!("hash `right` on shared columns, probe with `left`, keep matching left rows")
}
#[must_use]
pub fn natural_join(_left: &Relation, _right: &Relation) -> Relation {
todo!(
"hash one side on shared columns, probe with the other, emit \
left ++ (right \\ shared) for every match"
)
}