Produces one collection where each row is present with the sum of its frequencies in each input.
(self, other: Self)
| 1431 | |
| 1432 | /// Produces one collection where each row is present with the sum of its frequencies in each input. |
| 1433 | pub fn union(self, other: Self) -> Self { |
| 1434 | // Deconstruct `self` and `other` as `Union`s and reconstitute. |
| 1435 | let mut flat_inputs = Vec::with_capacity(2); |
| 1436 | if let MirRelationExpr::Union { base, inputs } = self { |
| 1437 | flat_inputs.push(*base); |
| 1438 | flat_inputs.extend(inputs); |
| 1439 | } else { |
| 1440 | flat_inputs.push(self); |
| 1441 | } |
| 1442 | if let MirRelationExpr::Union { base, inputs } = other { |
| 1443 | flat_inputs.push(*base); |
| 1444 | flat_inputs.extend(inputs); |
| 1445 | } else { |
| 1446 | flat_inputs.push(other); |
| 1447 | } |
| 1448 | |
| 1449 | MirRelationExpr::Union { |
| 1450 | base: Box::new(flat_inputs.remove(0)), |
| 1451 | inputs: flat_inputs, |
| 1452 | } |
| 1453 | } |
| 1454 | |
| 1455 | /// Arranges the collection by the specified columns |
| 1456 | pub fn arrange_by(self, keys: &[Vec<MirScalarExpr>]) -> Self { |