vrozov commented on code in PR #52237:
URL: https://github.com/apache/spark/pull/52237#discussion_r2325623953


##########
sql/api/src/main/scala/org/apache/spark/sql/streaming/progress.scala:
##########
@@ -326,4 +328,15 @@ private object SafeJsonSerializer {
     val keys = map.asScala.keySet.toSeq.sorted
     keys.map { k => k -> valueToJValue(map.get(k)): JObject }.reduce(_ ~ _)
   }
+
+  /** Convert BigDecimal to JValue while handling empty or infinite values */
+  def safeDecimalToJValue(value: Double): JValue = {
+    if (value.isNaN || value.isInfinity) {
+      JNothing
+    }

Review Comment:
   nit: while not enforced, single line`} else {` is more commonly used in 
Spark, AFAIK.



##########
sql/api/src/main/scala/org/apache/spark/sql/streaming/progress.scala:
##########
@@ -326,4 +328,15 @@ private object SafeJsonSerializer {
     val keys = map.asScala.keySet.toSeq.sorted
     keys.map { k => k -> valueToJValue(map.get(k)): JObject }.reduce(_ ~ _)
   }
+
+  /** Convert BigDecimal to JValue while handling empty or infinite values */
+  def safeDecimalToJValue(value: Double): JValue = {
+    if (value.isNaN || value.isInfinity) {
+      JNothing

Review Comment:
   Is there a corresponding test case for `isNaN`?



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