Skip to content

[SPARK-45602][CORE][SQL][SS][YARN][K8S] Replace s.c.MapOps.filterKeys with s.c.MapOps.view.filterKeys#43445

Closed
LuciferYang wants to merge 1 commit intoapache:masterfrom
LuciferYang:SPARK-45602
Closed

[SPARK-45602][CORE][SQL][SS][YARN][K8S] Replace s.c.MapOps.filterKeys with s.c.MapOps.view.filterKeys#43445
LuciferYang wants to merge 1 commit intoapache:masterfrom
LuciferYang:SPARK-45602

Conversation

@LuciferYang
Copy link
Contributor

@LuciferYang LuciferYang commented Oct 19, 2023

What changes were proposed in this pull request?

This pr replace s.c.MapOps.filterKeys with s.c.MapOps.view.filterKeys due to s.c.MapOps.filterKeys marked as deprecated since Scala 2.13.0:

https://github.com/scala/scala/blob/bf45e199e96383b96a6955520d7d2524c78e6e12/src/library/scala/collection/Map.scala#L248-L254

@deprecated("Use .view.filterKeys(f). A future version will include a strict version of this method (for now, .view.filterKeys(p).toMap).", "2.13.0")
  def filterKeys(p: K => Boolean): MapView[K, V] = new MapView.FilterKeys(this, p)

Why are the changes needed?

Cleanup deprecated API usage.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Pass GitHub Acitons

Was this patch authored or co-authored using generative AI tooling?

No

@LuciferYang LuciferYang changed the title [SPARK-45602][CORE][SQL][YARN][K8S] Replace s.c.MapOps.filterKeys with s.c.MapOps.view.filterKeys [SPARK-45602][CORE][SQL][SS][YARN][K8S] Replace s.c.MapOps.filterKeys with s.c.MapOps.view.filterKeys Oct 19, 2023
@LuciferYang
Copy link
Contributor Author

Merged into master for Spark 4.0. Thanks @HyukjinKwon


val startOffsets = newPartitionOffsets ++
oldStartPartitionOffsets.filterKeys(!deletedPartitions.contains(_))
oldStartPartitionOffsets.view.filterKeys(!deletedPartitions.contains(_))
Copy link
Contributor Author

@LuciferYang LuciferYang Dec 4, 2023

Choose a reason for hiding this comment

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

@cloud-fan This PR replaces s.c.MapOps.filterKeys with s.c.MapOps.view.filterKeys, which is similar to #43448 (comment). Does this also seem verbose to you? Should we replace it with another function, such as filter? Or do you have any better suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer filter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I will submit a pr.

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