Skip to content

Conversation

@LuciferYang
Copy link
Contributor

@LuciferYang LuciferYang commented Dec 26, 2022

What changes were proposed in this pull request?

This pr explicitly define Seq as collection.Seq in the ui related 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

@LuciferYang LuciferYang changed the title [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 [WIP][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 Dec 26, 2022
@LuciferYang LuciferYang changed the title [WIP][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 [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 Dec 26, 2022
@codecov-commenter
Copy link

codecov-commenter commented Dec 26, 2022

Codecov Report

Merging #39215 (1af0a51) into master (1af0a51) will not change coverage.
The diff coverage is n/a.

❗ Current head 1af0a51 differs from pull request most recent head 755a01e. Consider uploading reports for the commit 755a01e to get more accurate results

@@           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           
Flag Coverage Δ
unittests 90.93% <0.00%> (ø)

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

@LuciferYang LuciferYang marked this pull request as draft December 26, 2022 10:46
var physicalPlanDescription: String = null
var modifiedConfigs: Map[String, String] = _
var metrics = Seq[SQLPlanMetric]()
var metrics = scala.collection.Seq[SQLPlanMetric]()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just collection.Seq?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@LuciferYang LuciferYang marked this pull request as ready for review December 27, 2022 02:24
@LuciferYang LuciferYang marked this pull request as draft December 27, 2022 09:46
@github-actions github-actions bot added the BUILD label Dec 27, 2022
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"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add MimaExcludes for Scala 2.13, should we close this one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is acceptable, I will make more changes, otherwise I will close this pr

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those are all internal methods right? people wouldn't call these classes in code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@LuciferYang LuciferYang changed the title [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 [WIP][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 Dec 28, 2022
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"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scala 2.12 does not need to add these exclude filters, all changes only involve Scala 2.13.

@srowen
Copy link
Member

srowen commented Dec 28, 2022

Seems OK to me, un-mark it as Draft to let it test

@LuciferYang LuciferYang marked this pull request as ready for review December 28, 2022 05:50
@LuciferYang LuciferYang changed the title [WIP][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 [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 Dec 28, 2022
@LuciferYang
Copy link
Contributor Author

Local maven test with Scala 2.13, all passed

@srowen
Copy link
Member

srowen commented Dec 28, 2022

Merged to master

@srowen srowen closed this in 8cceb39 Dec 28, 2022
@LuciferYang
Copy link
Contributor Author

Thanks @srowen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants