Skip to content
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

Add MapArray constructors and doc example #4382

Merged
merged 6 commits into from
Jun 8, 2023

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Jun 7, 2023

Which issue does this PR close?

Closes #4385

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jun 7, 2023
@tustvold tustvold force-pushed the map-array-constructors branch from 140cd9b to e3fc71a Compare June 7, 2023 18:34
@@ -103,7 +104,7 @@ impl<OffsetSize: OffsetSizeTrait> GenericListArray<OffsetSize> {
let len = offsets.len() - 1; // Offsets guaranteed to not be empty
let end_offset = offsets.last().unwrap().as_usize();
// don't need to check other values of `offsets` because they are checked
// during construction of `OffsetsbBuffer`
// during construction of `OffsetsBuffer`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// during construction of `OffsetsBuffer`
// during construction of `OffsetBuffer`

}
if field.is_nullable() || entries.null_count() != 0 {
return Err(ArrowError::InvalidArgumentError(
"MapArray entries cannot contain be null".to_string(),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"MapArray entries cannot contain be null".to_string(),
"MapArray entries cannot contain null".to_string(),

let len = offsets.len() - 1; // Offsets guaranteed to not be empty
let end_offset = offsets.last().unwrap().as_usize();
// don't need to check other values of `offsets` because they are checked
// during construction of `OffsetsBuffer`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// during construction of `OffsetsBuffer`
// during construction of `OffsetBuffer`

@tustvold tustvold force-pushed the map-array-constructors branch from 030a38c to d52e101 Compare June 8, 2023 10:22
/// [`MapArray`] is physically a [`ListArray`] of key values pairs stored as an `entries`
/// [`StructArray`] with 2 child fields.
///
/// See [`MapBuilder`](crate::builder::MapBuilder) for how to construct a [`MapArray`]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't see a compelling reason to duplicate the example already on MapBuilder

@alamb alamb changed the title Add MapArray constructors Add MapArray constructors and doc example Jun 8, 2023
@tustvold tustvold merged commit fac00bf into apache:master Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add doc example of constructing a MapArray
3 participants