Convert rows to positional format, mapping by position rather than by name Used for set operations where column names may differ but positions must align
(
&self,
rows: Vec<Row>,
_source_variables: &[String],
target_variables: &[String],
)
| 7625 | /// Convert rows to positional format, mapping by position rather than by name |
| 7626 | /// Used for set operations where column names may differ but positions must align |
| 7627 | fn convert_to_positional_rows_aligned( |
| 7628 | &self, |
| 7629 | rows: Vec<Row>, |
| 7630 | _source_variables: &[String], |
| 7631 | target_variables: &[String], |
| 7632 | ) -> Vec<Row> { |
| 7633 | rows.into_iter() |
| 7634 | .map(|row| { |
| 7635 | let mut positional_values = Vec::new(); |
| 7636 | |
| 7637 | // Map values by NAME from source to target variables |
| 7638 | // For each target variable, find its value in the source row |
| 7639 | for target_var in target_variables.iter() { |
| 7640 | // Look for this target variable name in the source row |
| 7641 | if let Some(value) = row.values.get(target_var) { |
| 7642 | positional_values.push(value.clone()); |
| 7643 | } else { |
| 7644 | // Target variable not found in source, use NULL |
| 7645 | positional_values.push(Value::Null); |
| 7646 | } |
| 7647 | } |
| 7648 | |
| 7649 | Row::from_positional(positional_values, target_variables) |
| 7650 | }) |
| 7651 | .collect() |
| 7652 | } |
| 7653 | |
| 7654 | /// Execute UNION operation |
| 7655 | fn execute_union( |
no test coverage detected