You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/08 16:33:24 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #32098: [SPARK-34881][SQL][FOLLOWUP] Implement toString() and sql() methods for TRY_CAST

cloud-fan commented on a change in pull request #32098:
URL: https://github.com/apache/spark/pull/32098#discussion_r609886204



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryCast.scala
##########
@@ -84,4 +84,14 @@ case class TryCast(child: Expression, dataType: DataType, timeZoneId: Option[Str
 
   override def typeCheckFailureMessage: String =
     AnsiCast.typeCheckFailureMessage(child.dataType, dataType, None, None)
+
+  override def toString: String = {
+    s"try_cast($child as ${dataType.simpleString})"
+  }
+
+  override def sql: String = dataType match {
+    case _: ArrayType | _: MapType | _: StructType => child.sql

Review comment:
       can we copy the original comment as well?




-- 
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:
users@infra.apache.org



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