andygrove commented on code in PR #2630:
URL: https://github.com/apache/datafusion-comet/pull/2630#discussion_r2457643970


##########
spark/src/main/scala/org/apache/comet/serde/strings.scala:
##########
@@ -177,21 +187,16 @@ object CometStringRPad extends 
CometExpressionSerde[StringRPad] {
 
 object CometStringLPad extends CometExpressionSerde[StringLPad] {
 
-  /**
-   * Convert a Spark expression into a protocol buffer representation that can 
be passed into
-   * native code.
-   *
-   * @param expr
-   *   The Spark expression.
-   * @param inputs
-   *   The input attributes.
-   * @param binding
-   *   Whether the attributes are bound (this is only relevant in aggregate 
expressions).
-   * @return
-   *   Protocol buffer representation, or None if the expression could not be 
converted. In this
-   *   case it is expected that the input expression will have been tagged 
with reasons why it
-   *   could not be converted.
-   */
+  override def getSupportLevel(expr: StringLPad): SupportLevel = {
+    if (expr.str.isInstanceOf[Literal]) {
+      return Unsupported(Some("Scalar values are not supported for the str 
argument"))
+    }
+    if (!expr.pad.isInstanceOf[Literal]) {

Review Comment:
   Spark doesn't require pad to be a literal:
   
   ```
   scala> spark.sql("select a, lpad('foo', 6, a) from t1").show
   +---+---------------+
   |  a|lpad(foo, 6, a)|
   +---+---------------+
   |  $|         $$$foo|
   |  @|         @@@foo|
   +---+---------------+
   ```



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