Skip to content

Add deepCopy to VisibilityFilter #5385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged

Conversation

loganasherjones
Copy link
Contributor

This PR adds a deepCopy method to the user VisibilityFilter iterator.

This is a demonstration of how to solve #5372.

@ctubbsii ctubbsii added this to the 2.1.4 milestone Mar 24, 2025
@ctubbsii ctubbsii linked an issue Mar 24, 2025 that may be closed by this pull request
Copy link
Contributor

@ivakegg ivakegg left a comment

Choose a reason for hiding this comment

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

This deepcopy does not do a deepcopy of the evaluator or the cache but I think that is OK in this case as those can be reused and appended to by multiple instances of this source. A key note is that the copies will NOT be thread safe but that is usually not a concern as iterator should not be multi-threaded themselves for the most part.

@ctubbsii
Copy link
Member

I'll merge this commit, based on @ivakegg 's comments. I agree that a deep copy of the evaluator and cache are probably not needed here (since the options don't change). If thread safety is needed, we can consider additional PRs at that time, to create a fresh copy of the evaluator and cache for the deep copy of this. This fixes the reported NPE.

@ctubbsii ctubbsii merged commit 7ac517b into apache:2.1 Aug 13, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VisibilityFilter deepCopy after Init
3 participants