Reorder or remove columns to make `Union` happy.
(&mut self, output: Vec<CId>)
| 27 | |
| 28 | /// Reorder or remove columns to make `Union` happy. |
| 29 | pub(crate) fn apply_active_mapping(&mut self, output: Vec<CId>) -> Vec<CId> { |
| 30 | if let Some(mapping) = &self.active_positional_mapping { |
| 31 | // Check if the mapping indices are valid for the output |
| 32 | if mapping.iter().any(|idx| *idx >= output.len()) { |
| 33 | log::warn!( |
| 34 | "positional mapping indices out of bounds: mapping={mapping:?}, output_len={}", |
| 35 | output.len() |
| 36 | ); |
| 37 | // If mapping is invalid, don't apply it |
| 38 | return output; |
| 39 | } |
| 40 | |
| 41 | let new_output = mapping.iter().map(|idx| output[*idx]).collect(); |
| 42 | log::debug!("remapping {output:?} to {new_output:?} via {mapping:?}"); |
| 43 | new_output |
| 44 | } else { |
| 45 | output |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | pub fn compute_and_store_mapping(&mut self, before: &[CId], after: &[CId], riid: &RIId) { |
| 50 | let mapping: Vec<_> = after |
no test coverage detected