| 548 | } |
| 549 | |
| 550 | fn projected( |
| 551 | self, |
| 552 | _nested: &mut Iterative<'a, G, u64>, |
| 553 | _context: &mut I, |
| 554 | target_variables: &[Var], |
| 555 | ) -> ( |
| 556 | Collection<Iterative<'a, G, u64>, Vec<Value>, isize>, |
| 557 | ShutdownHandle, |
| 558 | ) { |
| 559 | if self.variables() == target_variables { |
| 560 | (self.tuples, ShutdownHandle::empty()) |
| 561 | } else { |
| 562 | let relation_variables = self.variables(); |
| 563 | let target_variables = target_variables.to_vec(); |
| 564 | |
| 565 | let tuples = self.tuples.map(move |tuple| { |
| 566 | target_variables |
| 567 | .iter() |
| 568 | .map(|x| { |
| 569 | let idx = relation_variables.binds(*x).unwrap(); |
| 570 | tuple[idx].clone() |
| 571 | }) |
| 572 | .collect() |
| 573 | }); |
| 574 | |
| 575 | (tuples, ShutdownHandle::empty()) |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | fn tuples_by_variables( |
| 580 | self, |