Modifies expr to match the DataType, metadata, and nullability of other if it is a placeholder with previously unspecified type information (i.e., most placeholders)
(expr: &mut Expr, other: &Expr, schema: &DFSchema)
| 2881 | // Modifies expr to match the DataType, metadata, and nullability of other if it is |
| 2882 | // a placeholder with previously unspecified type information (i.e., most placeholders) |
| 2883 | fn rewrite_placeholder(expr: &mut Expr, other: &Expr, schema: &DFSchema) -> Result<()> { |
| 2884 | if let Expr::Placeholder(Placeholder { id: _, field }) = expr |
| 2885 | && field.is_none() |
| 2886 | { |
| 2887 | let other_field = other.to_field(schema); |
| 2888 | match other_field { |
| 2889 | Err(e) => { |
| 2890 | Err(e.context(format!( |
| 2891 | "Can not find type of {other} needed to infer type of {expr}" |
| 2892 | )))?; |
| 2893 | } |
| 2894 | Ok((_, other_field)) => { |
| 2895 | // We can't infer the nullability of the future parameter that might |
| 2896 | // be bound, so ensure this is set to true |
| 2897 | *field = Some(other_field.as_ref().clone().with_nullable(true).into()); |
| 2898 | } |
| 2899 | } |
| 2900 | }; |
| 2901 | Ok(()) |
| 2902 | } |
| 2903 | |
| 2904 | #[macro_export] |
| 2905 | macro_rules! expr_vec_fmt { |
no test coverage detected
searching dependent graphs…