test: drive stdin store reuse through get_or_create#23061
Open
huan233usc wants to merge 1 commit into
Open
Conversation
Address review feedback on apache#22839: the reuses_buffered_stdin_store test created the store one way (StdinUtils::in_memory_object_store) and re-fetched it another (get_or_create), which obscured what reuse means. Seed the registry with a plain InMemory store (the genuine first read goes through get_or_create -> object_store, which consumes real process stdin and can't be driven from a unit test), then assert get_or_create hands back that exact store via Arc::ptr_eq rather than rebuilding it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Follow-up to #22839 (stdin support in
datafusion-cli), addressing post-merge review feedback from @alamb. No separate issue.Rationale for this change
In the review of #22839, @alamb noted the
reuses_buffered_stdin_storetest would be clearer if it used the same API to create and re-fetch the object store:The test built the buffered store via
StdinUtils::in_memory_object_storebut re-fetched it viaStdinUtils::get_or_create, which obscured what "reuse" actually guarantees.What changes are included in this PR?
Refactor
reuses_buffered_stdin_storeso the onlyStdinUtilsAPI it exercises isget_or_create:InMemorystore. The genuine first stdin read happens insideget_or_create→object_store, which consumes the real process stdin and so cannot be driven from a unit test; the comment now explains this.Arc::ptr_eqthatget_or_createhands back that exact store rather than rebuilding it — a stronger and clearer statement of the reuse invariant than comparing bytes alone.Test-only change; no production behavior change.
Are these changes tested?
Yes — this is a test change. Verified locally:
Are there any user-facing changes?
No.