kazuyukitanimura commented on code in PR #1470:
URL: https://github.com/apache/datafusion-comet/pull/1470#discussion_r1978834551


##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -1586,6 +1586,18 @@ object QueryPlanSerde extends Logging with 
ShimQueryPlanSerde with CometExprShim
       case StringTrimBoth(srcStr, trimStr, _) =>
         trim(expr, srcStr, trimStr, inputs, binding, "btrim")
 
+      case StringLPad(srcStr, size, chars) =>
+        val arg0 = exprToProtoInternal(srcStr, inputs, binding)
+        val arg1 = exprToProtoInternal(Cast(size, LongType), inputs, binding)
+        val arg2 = exprToProtoInternal(chars, inputs, binding)
+        scalarExprToProto("lpad", arg0, arg1, arg2)
+
+      case StringRPad(srcStr, size, chars) =>
+        val arg0 = exprToProtoInternal(srcStr, inputs, binding)
+        val arg1 = exprToProtoInternal(Cast(size, LongType), inputs, binding)
+        val arg2 = exprToProtoInternal(chars, inputs, binding)
+        scalarExprToProto("rpad", arg0, arg1, arg2)

Review Comment:
   
https://github.com/apache/datafusion-comet/blob/main/native/spark-expr/src/static_invoke/char_varchar_utils/read_side_padding.rs#L60
   I remember DataFusion uses graphemes vs Spark uses chars. Perhaps best to 
check postgres if it uses chars. If so, we may fix in DataFusion?
   chars has better performance as well



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