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/08/09 16:53:47 UTC

[GitHub] [spark] karenfeng commented on a change in pull request #33672: [SPARK-35320][SQL] Align error message for unsupported key types in MapType in Json reader

karenfeng commented on a change in pull request #33672:
URL: https://github.com/apache/spark/pull/33672#discussion_r685362337



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala
##########
@@ -402,7 +402,11 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
    * @since 2.0.0
    */
   @scala.annotation.varargs
-  def json(paths: String*): DataFrame = format("json").load(paths : _*)
+  def json(paths: String*): DataFrame = {
+    userSpecifiedSchema.foreach(
+      ExprUtils.checkJsonSchema(_).foreach(e => throw new AnalysisException(e)))

Review comment:
       Ideally, yes; and there would be an error class associated with this rather than an arbitrary error message. This one may be a little harder because we're using `TypeCheckFailure` with the same message. @allisonwang-db, what do you think?




-- 
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-unsubscribe@spark.apache.org

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