-
Notifications
You must be signed in to change notification settings - Fork 839
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 try_unary_mut #3134
Add try_unary_mut #3134
Changes from 1 commit
c98d21a
1b68fdf
0fdb8f8
338e605
1b3be81
9f07fa6
9220b76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,11 @@ impl NullBufferBuilder { | |
self.bitmap_builder = Some(b); | ||
} | ||
} | ||
|
||
#[inline] | ||
pub fn as_slice(&self) -> Option<&[u8]> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Could also add an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea |
||
self.bitmap_builder.as_ref().map(|b| b.as_slice()) | ||
} | ||
} | ||
|
||
impl NullBufferBuilder { | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -228,6 +228,14 @@ impl<T: ArrowPrimitiveType> PrimitiveBuilder<T> { | |||||||||||||||||||||
pub fn values_slice_mut(&mut self) -> &mut [T::Native] { | ||||||||||||||||||||||
self.values_builder.as_slice_mut() | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
/// Returns the current values buffer and null buffer as a slice | ||||||||||||||||||||||
pub fn as_slice(&mut self) -> (&mut [T::Native], Option<&[u8]>) { | ||||||||||||||||||||||
( | ||||||||||||||||||||||
self.values_builder.as_slice_mut(), | ||||||||||||||||||||||
self.null_buffer_builder.as_slice(), | ||||||||||||||||||||||
) | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Or something, it seems a bit unusual for both to not be mutable. We could then add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, it is because for this I don't need null buffer slice to be mutable. But yes, it looks a bit strange to have one mutable with one non-mutable. 😄 |
||||||||||||||||||||||
} | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
#[cfg(test)] | ||||||||||||||||||||||
|
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 think the reverse result order makes more sense, as it represents the order of fallibility. If we can't convert to a builder is the first error case, then within that we have the error case of ArrowError.
I think it will also make it easier to implement a fallback, e.g.
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.
Makes sense.