eric-maynard commented on code in PR #46408:
URL: https://github.com/apache/spark/pull/46408#discussion_r1594767881


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonSuite.scala:
##########
@@ -3865,6 +3865,24 @@ abstract class JsonSuite
       }
     }
   }
+
+  test("SPARK-48148: decimal precision is preserved when object is read as 
string") {
+    withTempPath { path =>
+
+      val granularFloat = "-999.99999999999999999999999999999999995"
+      val jsonString = s"""{"data": {"v": ${granularFloat}}}, {"data": {"v": 
${granularFloat}}}]"""
+
+      Seq(jsonString).toDF()
+        .repartition(1)
+        .write
+        .text(path.getAbsolutePath)
+
+      val df = spark.read.schema("data STRING").json(path.getAbsolutePath)
+
+      val expected = s"""{"v": ${granularFloat}}"""

Review Comment:
   Added more tests -- can you clarify the last example and what we expect that 
to do? It seems like invalid JSON



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