(
&mut self,
expr: &mut MirRelationExpr,
contexts: &Vec<IndexUsageContext>,
)
| 928 | } |
| 929 | |
| 930 | fn collect_index_reqs_inner( |
| 931 | &mut self, |
| 932 | expr: &mut MirRelationExpr, |
| 933 | contexts: &Vec<IndexUsageContext>, |
| 934 | ) -> Result<(), RecursionLimitError> { |
| 935 | self.checked_recur_mut(|this| { |
| 936 | // If an index exists on `on_id`, this function picks an index to be fully scanned. |
| 937 | let pick_index_for_full_scan = |on_id: &GlobalId| { |
| 938 | // Note that the choice we make here might be modified later at the |
| 939 | // "Adjust FullScans to not introduce a new index dependency". |
| 940 | choose_index( |
| 941 | this.source_keys, |
| 942 | on_id, |
| 943 | &this |
| 944 | .indexes_available |
| 945 | .indexes_on(*on_id) |
| 946 | .map(|(idx_id, key)| (idx_id, key.iter().cloned().collect_vec())) |
| 947 | .collect_vec(), |
| 948 | ) |
| 949 | }; |
| 950 | |
| 951 | // See comment on `IndexUsageContext`. |
| 952 | Ok(match expr { |
| 953 | MirRelationExpr::Join { |
| 954 | inputs, |
| 955 | implementation, |
| 956 | .. |
| 957 | } => { |
| 958 | match implementation { |
| 959 | JoinImplementation::Differential(..) => { |
| 960 | for input in inputs { |
| 961 | this.collect_index_reqs_inner( |
| 962 | input, |
| 963 | &IndexUsageContext::from_usage_type( |
| 964 | IndexUsageType::DifferentialJoin, |
| 965 | ), |
| 966 | )?; |
| 967 | } |
| 968 | } |
| 969 | JoinImplementation::DeltaQuery(..) => { |
| 970 | // For Delta joins, the first input is special, see |
| 971 | // https://github.com/MaterializeInc/database-issues/issues/2115 |
| 972 | this.collect_index_reqs_inner( |
| 973 | &mut inputs[0], |
| 974 | &IndexUsageContext::from_usage_type(IndexUsageType::DeltaJoin( |
| 975 | DeltaJoinIndexUsageType::Unknown, |
| 976 | )), |
| 977 | )?; |
| 978 | for input in &mut inputs[1..] { |
| 979 | this.collect_index_reqs_inner( |
| 980 | input, |
| 981 | &IndexUsageContext::from_usage_type(IndexUsageType::DeltaJoin( |
| 982 | DeltaJoinIndexUsageType::Lookup, |
| 983 | )), |
| 984 | )?; |
| 985 | } |
| 986 | } |
| 987 | JoinImplementation::IndexedFilter(_coll_id, idx_id, ..) => { |
no test coverage detected