xinlifoobar commented on code in PR #6312:
URL: https://github.com/apache/arrow-rs/pull/6312#discussion_r1734312483
##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -318,49 +318,53 @@ impl<T: ByteViewType + ?Sized> GenericByteViewArray<T> {
}
/// Returns an iterator over the prefix bytes of this array with respect
to the prefix length.
- /// If the prefix length is larger than the string length, it will return
the empty slice.
- pub fn prefix_bytes_iter(&self, prefix_len: usize) -> impl Iterator<Item =
&[u8]> {
- self.views().into_iter().map(move |v| {
- let len = (*v as u32) as usize;
-
- if len < prefix_len {
- return &[] as &[u8];
- }
-
- if prefix_len <= 4 || len <= 12 {
- unsafe { StringViewArray::inline_value(v, prefix_len) }
+ /// If the prefix length is larger than the string length, it will return
None.
+ pub fn prefix_bytes_iter(&self, prefix_len: usize) -> impl Iterator<Item =
Option<&[u8]>> {
+ self.views().into_iter().enumerate().map(move |(i, v)| {
+ if self.is_null(i) {
+ None
Review Comment:
This comment still points to the code... I have squash'ed everything in one
commit and please see the changes.
##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -318,49 +318,53 @@ impl<T: ByteViewType + ?Sized> GenericByteViewArray<T> {
}
/// Returns an iterator over the prefix bytes of this array with respect
to the prefix length.
- /// If the prefix length is larger than the string length, it will return
the empty slice.
- pub fn prefix_bytes_iter(&self, prefix_len: usize) -> impl Iterator<Item =
&[u8]> {
- self.views().into_iter().map(move |v| {
- let len = (*v as u32) as usize;
-
- if len < prefix_len {
- return &[] as &[u8];
- }
-
- if prefix_len <= 4 || len <= 12 {
- unsafe { StringViewArray::inline_value(v, prefix_len) }
+ /// If the prefix length is larger than the string length, it will return
None.
+ pub fn prefix_bytes_iter(&self, prefix_len: usize) -> impl Iterator<Item =
Option<&[u8]>> {
+ self.views().into_iter().enumerate().map(move |(i, v)| {
+ if self.is_null(i) {
+ None
Review Comment:
This comment still points to the old code... I have squash'ed everything in
one commit and please see the changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]