milosstojanovic commented on code in PR #50060:
URL: https://github.com/apache/spark/pull/50060#discussion_r1977510615


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/MsSqlServerDialect.scala:
##########
@@ -84,6 +84,17 @@ private case class MsSqlServerDialect() extends JdbcDialect 
with NoLegacyJDBCErr
       case _ => super.dialectFunctionName(funcName)
     }
 
+    override def visitSQLFunction(funcName: String, inputs: Array[String]): 
String =
+      funcName match {
+        case "RPAD" =>
+          val Array(str, len, pad) = inputs
+          s"LEFT(CONCAT($str, REPLICATE($pad, $len)), $len)"
+        case "LPAD" =>
+          val Array(str, len, pad) = inputs
+          s"RIGHT(CONCAT(REPLICATE($pad, $len), $str), $len)"
+        case _ => super.visitSQLFunction(funcName, inputs)
+      }

Review Comment:
   What do you mean? With my change in this PR `MsSqlServerDialect` will 
support pushdown of `RPAD` and `LPAD` using custom implementations since 
MsSQLServer does not support `RPAD` and `LPAD` natively



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to