Skip to content

MINOR: Optimize the entriesWithoutErrorsPerPartition when errorResults is empty#20410

Merged
chia7712 merged 2 commits intoapache:trunkfrom
m1a2st:MINOR-empty-map-optimize
Aug 26, 2025
Merged

MINOR: Optimize the entriesWithoutErrorsPerPartition when errorResults is empty#20410
chia7712 merged 2 commits intoapache:trunkfrom
m1a2st:MINOR-empty-map-optimize

Conversation

@m1a2st
Copy link
Copy Markdown
Collaborator

@m1a2st m1a2st commented Aug 26, 2025

If errorResults is empty, there’s no need to create a new
entriesPerPartition map.

Reviewers: Chia-Ping Tsai chia7712@gmail.com

@github-actions github-actions Bot added triage PRs from the community core Kafka Broker small Small PRs labels Aug 26, 2025
val entriesWithoutErrorsPerPartition = entriesPerPartition.filter { case (key, _) => !errorResults.contains(key) }
val entriesWithoutErrorsPerPartition =
if (errorResults.nonEmpty) entriesPerPartition.filter { case (key, _) => !errorResults.contains(key) }
else entriesPerPartition
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you please add comments explaining the minor optimization?

@chia7712 chia7712 merged commit a9b2a6d into apache:trunk Aug 26, 2025
23 checks passed
@github-actions github-actions Bot removed the triage PRs from the community label Aug 27, 2025
eduwercamacaro pushed a commit to littlehorse-enterprises/kafka that referenced this pull request Nov 12, 2025
…s is empty (apache#20410)

If `errorResults` is empty, there’s no need to create a new
`entriesPerPartition` map.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Kafka Broker small Small PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants