Projects `expressions` according to the given projection mapping. This function is similar to [`Self::project_expr`], but projects multiple expressions at once more efficiently than calling `project_expr` for each expression.
(
&'a self,
mapping: &'a ProjectionMapping,
expressions: impl IntoIterator<Item = &'a Arc<dyn PhysicalExpr>> + 'a,
)
| 666 | /// expressions at once more efficiently than calling `project_expr` for each |
| 667 | /// expression. |
| 668 | pub fn project_expressions<'a>( |
| 669 | &'a self, |
| 670 | mapping: &'a ProjectionMapping, |
| 671 | expressions: impl IntoIterator<Item = &'a Arc<dyn PhysicalExpr>> + 'a, |
| 672 | ) -> impl Iterator<Item = Option<Arc<dyn PhysicalExpr>>> + 'a { |
| 673 | let mut aug_mapping = None; |
| 674 | expressions.into_iter().map(move |expr| { |
| 675 | if let Some(targets) = mapping.get(expr) { |
| 676 | // If we match the source, we can project directly: |
| 677 | let (target, _) = targets.first(); |
| 678 | Some(Arc::clone(target)) |
| 679 | } else { |
| 680 | let aug_mapping = aug_mapping |
| 681 | .get_or_insert_with(|| self.augment_projection_mapping(mapping)); |
| 682 | Self::project_expr_indirect(aug_mapping, expr) |
| 683 | } |
| 684 | }) |
| 685 | } |
| 686 | |
| 687 | /// Projects this equivalence group according to the given projection mapping. |
| 688 | pub fn project(&self, mapping: &ProjectionMapping) -> Self { |