LuciferYang commented on code in PR #36885:
URL: https://github.com/apache/spark/pull/36885#discussion_r908084172
##########
core/src/test/scala/org/apache/spark/util/JsonProtocolSuite.scala:
##########
@@ -518,22 +582,98 @@ class JsonProtocolSuite extends SparkFunSuite {
val executorMetrics = new ExecutorMetrics(Array(12L, 23L, 45L, 67L, 78L,
89L,
90L, 123L, 456L, 789L, 40L, 20L, 20L, 10L, 20L, 10L, 301L))
val oldExecutorMetricsJson =
- JsonProtocol.executorMetricsToJson(executorMetrics)
- .removeField( _._1 == "MappedPoolMemory")
+ toJsonString(JsonProtocol.executorMetricsToJson(executorMetrics, _))
+ .removeField("MappedPoolMemory")
val expectedExecutorMetrics = new ExecutorMetrics(Array(12L, 23L, 45L, 67L,
78L, 89L, 90L, 123L, 456L, 0L, 40L, 20L, 20L, 10L, 20L, 10L, 301L))
assertEquals(expectedExecutorMetrics,
JsonProtocol.executorMetricsFromJson(oldExecutorMetricsJson))
}
+ test("EnvironmentUpdate backward compatibility: handle missing metrics
properties") {
+ // The "Metrics Properties" field was added in Spark 3.4.0:
+ val expectedEvent: SparkListenerEnvironmentUpdate = {
+ val e =
JsonProtocol.environmentUpdateFromJson(environmentUpdateJsonString)
+ e.copy(environmentDetails = e.environmentDetails.updated("Metrics
Properties", Seq.empty))
Review Comment:
Need a compatible way, for example:
```
e.environmentDetails + ("Metrics Properties" -> Seq.empty[(String, String)])
```
due to `scala.collection.Map` no longer has `updated` method in Scala 2.13
--
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]