[SPARK-41709][CORE][SQL][UI] Explicitly define Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13 - #39215
Conversation
Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13
Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13
Codecov Report
@@ Coverage Diff @@
## master #39215 +/- ##
=======================================
Coverage 90.95% 90.95%
=======================================
Files 342 342
Lines 76706 76706
Branches 10460 10460
=======================================
Hits 69765 69765
Misses 5352 5352
Partials 1589 1589
Flags with carried forward coverage won't be shown. Click here to find out more. 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
| var physicalPlanDescription: String = null | ||
| var modifiedConfigs: Map[String, String] = _ | ||
| var metrics = Seq[SQLPlanMetric]() | ||
| var metrics = scala.collection.Seq[SQLPlanMetric]() |
| ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.spark.storage.BlockManagerMessages#RegisterBlockManager.apply"), | ||
|
|
||
| // [SPARK-41709][CORE][SQL][UI] Explicitly define Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13 | ||
| ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.apache.spark.status.api.v1.ApplicationEnvironmentInfo.resourceProfiles"), |
There was a problem hiding this comment.
Need to add MimaExcludes for Scala 2.13, should we close this one
There was a problem hiding this comment.
If this is acceptable, I will make more changes, otherwise I will close this pr
There was a problem hiding this comment.
I think those are all internal methods right? people wouldn't call these classes in code
There was a problem hiding this comment.
Yes, the mima filters to be added are all internal apis
| val errorMessage = getOptional(ui.hasErrorMessage, () => ui.getErrorMessage) | ||
| val metrics = | ||
| ui.getMetricsList.asScala.map(m => SQLPlanMetricSerializer.deserialize(m)).toSeq | ||
| ui.getMetricsList.asScala.map(m => SQLPlanMetricSerializer.deserialize(m)) |
There was a problem hiding this comment.
If no toSeq, one operation is about 10ns. After adding toSeq, the delay will increase linearly with the length of the original data:
- 240ns when input length is 10
- 1740ns when input length is 100
- 16600ns when input length is 1000
Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13
| ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.spark.storage.BlockManagerMessages#RegisterBlockManager.apply"), | ||
|
|
||
| // [SPARK-41709][CORE][SQL][UI] Explicitly define Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13 | ||
| ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.apache.spark.status.api.v1.ApplicationEnvironmentInfo.sparkProperties"), |
There was a problem hiding this comment.
Scala 2.12 does not need to add these exclude filters, all changes only involve Scala 2.13.
|
Seems OK to me, un-mark it as Draft to let it test |
Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13Seq as collection.Seq to avoid toSeq when create ui objects from protobuf objects for Scala 2.13
|
Local maven test with Scala 2.13, all passed |
|
Merged to master |
|
Thanks @srowen |
What changes were proposed in this pull request?
This pr explicitly define
Seqascollection.Seqin theuirelated class definitions to avoid collection conversion when creating ui objects from protobuf objects to make no performance difference between Scala 2.13 and Scala 2.12.Why are the changes needed?
Avoid collection conversion when creating ui objects from protobuf objects for Scala 2.13.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Pass GitHub Actions