beliefer commented on a change in pull request #25172: [SPARK-28412][SQL] ANSI 
SQL: OVERLAY function support byte array
URL: https://github.com/apache/spark/pull/25172#discussion_r305665865
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ##########
 @@ -1428,6 +1428,13 @@ class AstBuilder(conf: SQLConf) extends 
SqlBaseBaseVisitor[AnyRef] with Logging
   override def visitOverlay(ctx: OverlayContext): Expression = withOrigin(ctx) 
{
     val input = expression(ctx.input)
     val replace = expression(ctx.replace)
+    (input.dataType, replace.dataType) match {
+      case (StringType, StringType) | (BinaryType, BinaryType) =>
+      case (inputType, replaceType) =>
+        throw new ParseException(s"Invalid data type $inputType and 
$replaceType. " +
+          "The result type of the input expression and the output expression 
are " +
+          "either String or Byte Array.", ctx)
 
 Review comment:
   @maropu A good suggestion.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to