goldmedal commented on code in PR #11452: URL: https://github.com/apache/datafusion/pull/11452#discussion_r1677998536
########## 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: Hmm, okay. After some research, I believe it's not easy to move `make_array` to `functions`. It's tied to methods in `utils.rs` and `macro.rs`. Moving all the required methods to `functions` could make the codebase chaotic. For now, I prefer to keep them in `functions-arrays` first. We can do it in another PR. -- 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