jayzhan211 commented on issue #11546:
URL: https://github.com/apache/datafusion/issues/11546#issuecomment-2241145354
```rust
pub fn map(keys: Vec<Expr>, values: Vec<Expr>) -> Expr {
let keys = make_array(keys);
let values = make_array(values);
Expr::ScalarFunction(ScalarFunction::new_udf(
map_udf(),
vec![keys, values],
))
}
pub fn map_from_array(keys: Vec<Expr>, values: Vec<Expr>) -> Expr {
let keys = make_array(keys);
let values = make_array(values);
Expr::ScalarFunction(ScalarFunction::new_udf(
map_one_udf(),
vec![keys, values],
))
}
```
It seems they both compute `make_array`, but I think we can avoid
`make_array` at all.
```rust
pub fn map_from_array(keys: Vec<Expr>, values: Vec<Expr>) -> Expr {
let mut args = keys;
args.extend(values);
Expr::ScalarFunction(ScalarFunction::new_udf(
map_one_udf(),
args,
))
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]