-
Notifications
You must be signed in to change notification settings - Fork 817
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
feat: add take for MapArray #3925
Conversation
arrow-array/src/array/map_array.rs
Outdated
let old_data = value.to_data(); | ||
let array_data = unsafe { | ||
ArrayData::new_unchecked( | ||
DataType::Map(field.clone(), false), | ||
old_data.len(), | ||
Some(old_data.null_count()), | ||
old_data.nulls().map(|nulls|nulls.buffer().clone()), | ||
old_data.offset(), | ||
old_data.buffers().to_vec(), | ||
old_data.child_data().to_vec(), | ||
) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to create a copy of ArrayData
that's the same except for the type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
into_builder()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that's much better!
arrow-array/src/array/map_array.rs
Outdated
@@ -251,6 +251,69 @@ impl std::fmt::Debug for MapArray { | |||
} | |||
} | |||
|
|||
impl TryFrom<&ListArray> for MapArray { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl TryFrom<&ListArray> for MapArray { | |
impl TryFrom<ListArray> for MapArray { |
To be consistent with other array conversions, and to make the clone explicit if necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this one.
arrow-array/src/array/map_array.rs
Outdated
let old_data = value.to_data(); | ||
let array_data = unsafe { | ||
ArrayData::new_unchecked( | ||
DataType::Map(field.clone(), false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This data type inference is potentially problematic, as it loses part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you meant here, but I deleted this implementation so not sure it's relevant anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
* feat: add take for MapArray * refactor: use into_builder
* feat: add take for MapArray * refactor: use into_builder
* feat: add take for MapArray * refactor: use into_builder
* feat: add take for MapArray * refactor: use into_builder
* feat: add take for MapArray * refactor: use into_builder
Which issue does this PR close?
Closes #3875
Rationale for this change
This seems to be one of the only array types that isn't supported by this function.
What changes are included in this PR?
Adds an easy conversion between
MapArray
andListArray
, which allows us to reuse kernels that supportListArray
.Are there any user-facing changes?
No breaking changes.