dharanad commented on code in PR #12153:
URL: https://github.com/apache/datafusion/pull/12153#discussion_r1733274993


##########
datafusion/functions-nested/src/map.rs:
##########
@@ -61,14 +62,46 @@ fn make_map_batch(args: &[ColumnarValue]) -> 
datafusion_common::Result<ColumnarV
 
     let data_type = args[0].data_type();
     let can_evaluate_to_const = can_evaluate_to_const(args);
-    let key = get_first_array_ref(&args[0])?;
-    let value = get_first_array_ref(&args[1])?;
-    make_map_batch_internal(key, value, can_evaluate_to_const, data_type)
+
+    // check the keys array is unique
+    let keys = get_first_array_ref(&args[0])?;
+    let key_array = keys.as_ref();
+
+    match &args[0] {
+        ColumnarValue::Array(_) => {
+            for i in 0..key_array.len() {
+                let row_keys = key_array.slice(i, 1);
+                let row_keys = first_array_for_list(row_keys.as_ref());

Review Comment:
   Can we use `datafusion_common::utils::list_to_arrays::<O>(keys)` here ?
   Also any specific reason for making this a inner fn ? why not move it out ? 
For better readability



-- 
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]

Reply via email to