goldmedal commented on code in PR #11452: URL: https://github.com/apache/datafusion/pull/11452#discussion_r1677923547
########## datafusion/functions-array/src/planner.rs: ########## @@ -97,6 +98,27 @@ impl ExprPlanner for ArrayFunctionPlanner { ) -> Result<PlannerResult<Vec<Expr>>> { Ok(PlannerResult::Planned(make_array(exprs))) } + + fn plan_make_map(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>> { + if args.len() % 2 != 0 { + return exec_err!("make_map requires an even number of arguments"); + } + + let (keys, values): (Vec<_>, Vec<_>) = args + .chunks_exact(2) + .map(|chunk| (chunk[0].clone(), chunk[1].clone())) + .unzip(); + + let keys = make_array(keys); + let values = make_array(values); Review Comment: Yes, I think moving `make_array_inner` to functions is a good idea. It would be beneficial for many scenarios. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org