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


##########
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:
   Are the results of 
   ```scala
   DataType.fromJson(exp.getLiteral.getString)
   ```
   and
   
   ```scala
   DataType.fromJson(extractString(children(1), "schema"))
   ```
   
   the same? Is it possible to save one one invocation of `DataType.fromJson`?



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to