Returns the last index before encountering a column coming from the right table when traveling through the projection from left to right, and the last index before encountering a column coming from the left table when traveling through the projection from right to left. If there is no column in the projection coming from the left side, it returns (-1, ...), if there is no column in the projection
(
left_table_column_count: usize,
projection_as_columns: &[(Column, String)],
)
| 907 | /// If there is no column in the projection coming from the left side, it returns (-1, ...), |
| 908 | /// if there is no column in the projection coming from the right side, it returns (..., projection length). |
| 909 | pub fn join_table_borders( |
| 910 | left_table_column_count: usize, |
| 911 | projection_as_columns: &[(Column, String)], |
| 912 | ) -> (i32, i32) { |
| 913 | let far_right_left_col_ind = projection_as_columns |
| 914 | .iter() |
| 915 | .enumerate() |
| 916 | .take_while(|(_, (projection_column, _))| { |
| 917 | projection_column.index() < left_table_column_count |
| 918 | }) |
| 919 | .last() |
| 920 | .map(|(index, _)| index as i32) |
| 921 | .unwrap_or(-1); |
| 922 | |
| 923 | let far_left_right_col_ind = projection_as_columns |
| 924 | .iter() |
| 925 | .enumerate() |
| 926 | .rev() |
| 927 | .take_while(|(_, (projection_column, _))| { |
| 928 | projection_column.index() >= left_table_column_count |
| 929 | }) |
| 930 | .last() |
| 931 | .map(|(index, _)| index as i32) |
| 932 | .unwrap_or(projection_as_columns.len() as i32); |
| 933 | |
| 934 | (far_right_left_col_ind, far_left_right_col_ind) |
| 935 | } |
| 936 | |
| 937 | /// Tries to update the equi-join `Column`'s of a join as if the input of |
| 938 | /// the join was replaced by a projection. |
no test coverage detected
searching dependent graphs…