jayzhan211 commented on code in PR #11452: URL: https://github.com/apache/datafusion/pull/11452#discussion_r1677237773
########## 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: Maybe we could move `make-array` to functions core-feature? -- 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