cloud-fan commented on code in PR #36330:
URL: https://github.com/apache/spark/pull/36330#discussion_r875847407


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -251,6 +251,24 @@ abstract class JdbcDialect extends Serializable with 
Logging{
           s"${this.getClass.getSimpleName} does not support function: 
$funcName")
       }
     }
+
+    override def visitOverlay(inputs: Array[String]): String = {
+      if (isSupportedFunction("OVERLAY")) {
+        super.visitOverlay(inputs)
+      } else {
+        throw new UnsupportedOperationException(
+          s"${this.getClass.getSimpleName} does not support function: OVERLAY")
+      }
+    }
+
+    override def visitTrim(direction: String, inputs: Array[String]): String = 
{

Review Comment:
   With the current framework, I don't think `OVERLAY` and `TRIM` are SQL 
functions (`visitSQLFunction`). I think `TRIM`  is common enough, but `OVERLAY` 
is not. Maybe we should by default throw error in 
`JDBCSQLBuilder.visitOverlay`. H2 dialect can override `compileExpression` to 
support OVERLAY.



##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -251,6 +251,24 @@ abstract class JdbcDialect extends Serializable with 
Logging{
           s"${this.getClass.getSimpleName} does not support function: 
$funcName")
       }
     }
+
+    override def visitOverlay(inputs: Array[String]): String = {
+      if (isSupportedFunction("OVERLAY")) {
+        super.visitOverlay(inputs)
+      } else {
+        throw new UnsupportedOperationException(
+          s"${this.getClass.getSimpleName} does not support function: OVERLAY")
+      }
+    }
+
+    override def visitTrim(direction: String, inputs: Array[String]): String = 
{

Review Comment:
   With the current framework, I don't think `OVERLAY` and `TRIM` are SQL 
functions (`visitSQLFunction`). I think `TRIM`  is common enough, but `OVERLAY` 
is not. Maybe we should by default throw error in 
`JDBCSQLBuilder.visitOverlay`. H2 dialect can override `compileExpression` to 
support OVERLAY if we want to.



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