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


##########
native/spark-expr/src/static_invoke/char_varchar_utils/read_side_padding.rs:
##########
@@ -28,17 +28,22 @@ use std::sync::Arc;
 const SPACE: &str = " ";
 /// Similar to DataFusion `rpad`, but not to truncate when the string is 
already longer than length
 pub fn spark_read_side_padding(args: &[ColumnarValue]) -> 
Result<ColumnarValue, DataFusionError> {
-    spark_read_side_padding2(args, false)
+    spark_read_side_padding2(args, false, false)
 }
 
 /// Custom `rpad` because DataFusion's `rpad` has differences in unicode 
handling
 pub fn spark_rpad(args: &[ColumnarValue]) -> Result<ColumnarValue, 
DataFusionError> {
-    spark_read_side_padding2(args, true)
+    spark_read_side_padding2(args, true, false)
+}
+
+pub fn spark_lpad(args: &[ColumnarValue]) -> Result<ColumnarValue, 
DataFusionError> {

Review Comment:
   Done



##########
native/spark-expr/src/static_invoke/char_varchar_utils/read_side_padding.rs:
##########
@@ -250,6 +271,10 @@ fn add_padding_string(
     } else {
         let pad_needed = length - char_len;
         let pad: String = 
pad_string.chars().cycle().take(pad_needed).collect();
-        Ok(string + &pad)
+        if is_left_pad {
+            Ok(format!("{}{}", pad, string))
+        } else {
+            Ok(string + &pad)
+        }

Review Comment:
   Done



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