kazantsev-maksim commented on code in PR #5416:
URL: https://github.com/apache/datafusion-comet/pull/5416#discussion_r3960706113


##########
native/spark-expr/src/string_funcs/split.rs:
##########
@@ -159,35 +212,249 @@ pub fn spark_split_sql(args: &[ColumnarValue]) -> 
DataFusionResult<ColumnarValue
                 }
                 _ => return exec_err!("split_sql delimiter must be a string"),
             };
+            let string = string.clone().unwrap();
+
+            let mut offsets_builder = BufferBuilder::<i32>::new(2);
+            let mut values_builder = BufferBuilder::<u8>::new(string.len());
+
+            offsets_builder.append(0);
+
+            if delimiter.is_empty() {
+                values_builder.append_slice(string.as_bytes());
+                offsets_builder.append(string.len() as i32);
+            } else {
+                let mut offset = 0i32;
+                for part in string.split(delimiter.as_str()) {
+                    values_builder.append_slice(part.as_bytes());
+                    offset += part.len() as i32;
+                    offsets_builder.append(offset);
+                }
+            }
 
-            let result = split_sql_string(string.as_ref().unwrap(), delimiter);
-            let string_array = GenericStringArray::<i32>::from(result);
-            let list_array = create_list_array(Arc::new(string_array));
+            let offsets_buffer = offsets_builder.finish();
+            let values_buffer = values_builder.finish();
 
-            Ok(ColumnarValue::Scalar(ScalarValue::List(Arc::new(
-                list_array,
-            ))))
+            let list_field = Arc::new(Field::new("item", DataType::Utf8, 
true));

Review Comment:
   thanks, fixed



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