-
Notifications
You must be signed in to change notification settings - Fork 394
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
Remove use of into_arrow2_buffer
in generated code
#8731
Conversation
@rerun-bot full-check |
into_arrow2_buffer
in generated code
Started a full build: https://github.com/rerun-io/rerun/actions/runs/12856032271 |
Web viewer failed to build. | Result | Commit | Link | Manifest | Note: This comment is updated whenever you push a commit. |
// Offsets is always non-empty. The last element is the total length of buffer we need. | ||
#[allow(clippy::unwrap_used)] | ||
let capacity = offsets.last().copied().unwrap() as usize; | ||
|
||
let mut buffer_builder = arrow::array::builder::BufferBuilder::<u8>::new(capacity); | ||
// NOTE: Flattening to remove the guaranteed layer of nullability: we don't care | ||
// about it while building the backing buffer since it's all offsets driven. | ||
let inner_data: arrow::buffer::Buffer = | ||
#data_src.into_iter().flatten() #quoted_transparent_mapping.collect(); | ||
for data in #data_src.iter().flatten() { | ||
buffer_builder.append_slice(data #quoted_member_accessor.as_bytes()); | ||
} | ||
let inner_data: arrow::buffer::Buffer = buffer_builder.finish(); |
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 surprised we can't just use a collect()
here and below, Buffer
seems to implement `FromIterator?
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.
We can, but I wanted to pre-allocate (reserve) the exact amount of bytes we need.
I'll add a comment explaining this
re_arrow2
toarrow
#3741