itholic commented on code in PR #33525:
URL: https://github.com/apache/spark/pull/33525#discussion_r862656022


##########
sql/core/src/test/scala/org/apache/spark/sql/JsonFunctionsSuite.scala:
##########
@@ -390,11 +390,15 @@ class JsonFunctionsSuite extends QueryTest with 
SharedSparkSession {
 
   test("SPARK-24027: from_json of a map with unsupported key type") {
     val schema = MapType(StructType(StructField("f", IntegerType) :: Nil), 
StringType)
-
-    checkAnswer(Seq("""{{"f": 1}: "a"}""").toDS().select(from_json($"value", 
schema)),
-      Row(null))
-    checkAnswer(Seq("""{"{"f": 1}": "a"}""").toDS().select(from_json($"value", 
schema)),
-      Row(null))
+    val startMsg = "cannot resolve 'entries' due to data type mismatch:"
+    val exception1 = intercept[AnalysisException] {
+      Seq("""{{"f": 1}: "a"}""").toDS().select(from_json($"value", schema))
+    }.getMessage
+    assert(exception1.contains(startMsg))
+    val exception2 = intercept[AnalysisException] {
+      Seq("""{{"f": 1}: "a"}""").toDS().select(from_json($"value", schema))
+    }.getMessage
+    assert(exception2.contains(startMsg))

Review Comment:
   Seems like the tests here are duplicated. Should we remove or correct one of 
them ??
   
   cc @planga82
   also cc @HyukjinKwon FYI



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