milastdbx commented on code in PR #45564:
URL: https://github.com/apache/spark/pull/45564#discussion_r1529107460


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/MsSqlServerDialect.scala:
##########
@@ -86,6 +87,34 @@ private object MsSqlServerDialect extends JdbcDialect {
       case "STDDEV_SAMP" => "STDEV"
       case _ => super.dialectFunctionName(funcName)
     }
+
+    override def build(expr: Expression): String = {
+      def isChildLikeExpression(child: Expression): Boolean = child match {
+        case gse: GeneralScalarExpression =>
+          gse.name() match {
+            case "STARTS_WITH" | "ENDS_WITH" | "CONTAINS" => true
+            case _ => false
+          }
+        case _ => false
+      }
+
+      expr match {
+        case e: GeneralScalarExpression =>
+          e.name() match {
+            case "=" | "<>" | "<=>" | "<" | "<=" | ">" | ">=" =>
+              if (isChildLikeExpression(e.children()(0))
+                || isChildLikeExpression(e.children()(1))) {
+                throw new SparkUnsupportedOperationException(

Review Comment:
   why dont we just call `visitUnexpectedExpr` of parent class ?
   
   We do not propagate these errors to users, hence I think making error class 
for it is overkill



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