coderfender commented on code in PR #2099:
URL: https://github.com/apache/datafusion-comet/pull/2099#discussion_r2271180183


##########
native/spark-expr/src/static_invoke/char_varchar_utils/read_side_padding.rs:
##########
@@ -71,44 +101,101 @@ fn spark_read_side_padding2(
     }
 }
 
+enum RPadArgument {
+    ConstLength(i32),
+    ColArray(ArrayRef),
+}
+
 fn spark_read_side_padding_internal<T: OffsetSizeTrait>(
     array: &ArrayRef,
-    length: i32,
     truncate: bool,
+    rpad_argument: RPadArgument,
 ) -> Result<ColumnarValue, DataFusionError> {
     let string_array = as_generic_string_array::<T>(array)?;
-    let length = 0.max(length) as usize;
-    let space_string = " ".repeat(length);
+    match rpad_argument {
+        RPadArgument::ColArray(array_int) => {
+            let int_pad_array = array_int.as_primitive::<Int32Type>();
+            let mut str_pad_value_map = HashMap::new();

Review Comment:
   Thats a great suggestion @mbutrovich  . I went ahead and  removed hashmap 
creation and changed logic iterate through the arrays together . 



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

Reply via email to