zhengruifeng commented on code in PR #47415:
URL: https://github.com/apache/spark/pull/47415#discussion_r1684079077


##########
connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -2189,6 +2155,19 @@ class SparkConnectPlanner(
     case other => throw InvalidPlanInput(s"$field should be created by map, 
but got $other")
   }
 
+  // Check whether this proto expression is a literal string representing a 
JSON-formatted schema
+  private def isJsonSchema(exp: proto.Expression): Boolean = {
+    exp.getExprTypeCase match {
+      case proto.Expression.ExprTypeCase.LITERAL =>
+        exp.getLiteral.getLiteralTypeCase match {
+          case proto.Expression.Literal.LiteralTypeCase.STRING =>
+            Try { DataType.fromJson(exp.getLiteral.getString) }.isSuccess

Review Comment:
   they are the same.
   
   >  Is it possible to save one one invocation of DataType.fromJson?
   
   Good point, I think we can do it



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