table::join
On this page
Hash joins. The right table's key codes go into an Index (one
group per distinct key, its rows contiguous); each left row is hashed
and probed. Text keys of both sides share one dictionary, so the
probe compares integers. A null key matches nothing.
Enums
HowSource
pub enum HowWhich rows a join keeps.
| How | Rows |
|---|---|
Inner | every matching pair |
Left | every left row, matched or with nulls on the right |
Right | every right row, matched or with nulls on the left |
Outer | Left, then the right rows nothing matched |
Semi | left rows that have a match (left columns only) |
Anti | left rows that have none (left columns only) |
Implementations
impl Table
Join with
oon the columnson, present in both.nabiuse table::How; let a = table::table!{ "id": [1, 2, 3], "x": ["a", "b", "c"] }; let b = table::table!{ "id": [3, 1, 1], "y": [30.0, 10.0, 11.0] }; let j = try a.join(b, ["id"], How::Inner) catch _ { a }; assert(j.names() == ["id", "x", "y"]); assert(j.nrows() == 3); let l = try a.join(b, ["id"], How::Left) catch _ { a }; assert(l.nrows() == 4 && l.row(2).f64("y") is none);
Sourcepub fn join_on(§self, o: Table, left_on: List<str>, right_on: List<str>, how: How) throws (TableError) -> Table Join where the key columns have different names:
left_on[k]of this table matchesright_on[k]ofo. The result has this table's columns, theno's other columns; a name both sides use gets_rightono's side. ForOuter/Right, a key column holds the key of whichever side has the row.