doc: Describe potential footgun in MapArray::keys and values - #11145
Open
neilconway wants to merge 1 commit into
Open
neilconway wants to merge 1 commit into
neilconway wants to merge 1 commit into
Conversation
Contributor
Author
|
Noticed this in apache/datafusion#25543 |
Rich-T-kid
approved these changes
Sep 20, 2026
Comment on lines
218
to
+224
| /// Returns a reference to the keys of this map | ||
| /// | ||
| /// Note: The map array may not refer to all keys in the returned array. | ||
| /// For example, after slicing via [`Self::slice`], the returned array may | ||
| /// contain keys both before and after the slice. Use [`Self::value_offsets`] | ||
| /// to determine the range of keys for each map. These offsets index into | ||
| /// the returned array and may not start at zero. |
Contributor
There was a problem hiding this comment.
Suggested change
| /// Returns a reference to the keys of this map | |
| /// | |
| /// Note: The map array may not refer to all keys in the returned array. | |
| /// For example, after slicing via [`Self::slice`], the returned array may | |
| /// contain keys both before and after the slice. Use [`Self::value_offsets`] | |
| /// to determine the range of keys for each map. These offsets index into | |
| /// the returned array and may not start at zero. | |
| /// Returns a reference to all the keys of this map | |
| /// this includes keys that may have been [`Self::slice`]'ed off |
This branch has not been deployed
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?
Rationale for this change
The behavior of the
keysandvaluesmethods of aMapArraycan be a bit surprising. This PR documents that behavior; consistent with the documentation forListArray::values, which behaves similarly.What changes are included in this PR?
Are these changes tested?
Existing tests pass.
Are there any user-facing changes?
No.