Adds the `offset` value to `Column` indices inside `expr`. This function is generally used during the update of the right table schema in join operations.
(
expr: Arc<dyn PhysicalExpr>,
offset: isize,
)
| 35 | /// Adds the `offset` value to `Column` indices inside `expr`. This function is |
| 36 | /// generally used during the update of the right table schema in join operations. |
| 37 | pub fn add_offset_to_expr( |
| 38 | expr: Arc<dyn PhysicalExpr>, |
| 39 | offset: isize, |
| 40 | ) -> Result<Arc<dyn PhysicalExpr>> { |
| 41 | expr.transform_down(|e| match e.downcast_ref::<Column>() { |
| 42 | Some(col) => { |
| 43 | let Some(idx) = col.index().checked_add_signed(offset) else { |
| 44 | return plan_err!("Column index overflow"); |
| 45 | }; |
| 46 | Ok(Transformed::yes(Arc::new(Column::new(col.name(), idx)))) |
| 47 | } |
| 48 | None => Ok(Transformed::no(e)), |
| 49 | }) |
| 50 | .data() |
| 51 | } |
| 52 | |
| 53 | /// This function is similar to the `contains` method of `Vec`. It finds |
| 54 | /// whether `expr` is among `physical_exprs`. |
searching dependent graphs…