()
| 4240 | |
| 4241 | #[test] |
| 4242 | fn test_accept_exprs() { |
| 4243 | fn accept_exprs<E: AsRef<Expr>>(_: &[E]) {} |
| 4244 | |
| 4245 | let expr = || -> Expr { lit(1) }; |
| 4246 | |
| 4247 | // Call accept_exprs with owned expressions |
| 4248 | let owned_exprs = vec![expr(), expr()]; |
| 4249 | accept_exprs(&owned_exprs); |
| 4250 | |
| 4251 | // Call accept_exprs with expressions from expr tree |
| 4252 | let udf = Expr::ScalarFunction(ScalarFunction { |
| 4253 | func: Arc::new(ScalarUDF::new_from_impl(TestUDF {})), |
| 4254 | args: vec![expr(), expr()], |
| 4255 | }); |
| 4256 | let Expr::ScalarFunction(scalar) = &udf else { |
| 4257 | unreachable!() |
| 4258 | }; |
| 4259 | accept_exprs(&scalar.args); |
| 4260 | |
| 4261 | // Call accept_exprs with expressions collected from expr tree, without cloning |
| 4262 | let mut collected_refs: Vec<&Expr> = scalar.args.iter().collect(); |
| 4263 | collected_refs.extend(&owned_exprs); |
| 4264 | accept_exprs(&collected_refs); |
| 4265 | |
| 4266 | // test helpers |
| 4267 | #[derive(Debug, PartialEq, Eq, Hash)] |
| 4268 | struct TestUDF {} |
| 4269 | impl ScalarUDFImpl for TestUDF { |
| 4270 | fn name(&self) -> &str { |
| 4271 | unimplemented!() |
| 4272 | } |
| 4273 | |
| 4274 | fn signature(&self) -> &Signature { |
| 4275 | unimplemented!() |
| 4276 | } |
| 4277 | |
| 4278 | fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> { |
| 4279 | unimplemented!() |
| 4280 | } |
| 4281 | |
| 4282 | fn invoke_with_args( |
| 4283 | &self, |
| 4284 | _args: ScalarFunctionArgs, |
| 4285 | ) -> Result<ColumnarValue> { |
| 4286 | unimplemented!() |
| 4287 | } |
| 4288 | } |
| 4289 | } |
| 4290 | |
| 4291 | mod intersect_metadata_tests { |
| 4292 | use super::super::intersect_metadata_for_union; |
nothing calls this directly
no test coverage detected
searching dependent graphs…