Skip to content

Commit

Permalink
Revert unrelated changes to align_buffers()
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecrv committed Feb 15, 2025
1 parent a21978e commit 4895ac8
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions arrow-data/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,21 +697,17 @@ impl ArrayData {
///
/// This also aligns buffers of children data
pub fn align_buffers(&mut self) {
// use a dynamic stack to avoid stack overflow for very deeply nested arrays
let mut stack: Vec<&mut ArrayData> = vec![self];
while let Some(data) = stack.pop() {
let layout = layout(&data.data_type);
for (buffer, spec) in data.buffers.iter_mut().zip(&layout.buffers) {
if let BufferSpec::FixedWidth { alignment, .. } = spec {
if buffer.as_ptr().align_offset(*alignment) != 0 {
*buffer = Buffer::from_slice_ref(buffer.as_ref());
}
let layout = layout(&self.data_type);
for (buffer, spec) in self.buffers.iter_mut().zip(&layout.buffers) {
if let BufferSpec::FixedWidth { alignment, .. } = spec {
if buffer.as_ptr().align_offset(*alignment) != 0 {
*buffer = Buffer::from_slice_ref(buffer.as_ref());
}
}
// align children data recursively
for child in data.child_data.iter_mut() {
stack.push(child);
}
}
// align children data recursively
for data in self.child_data.iter_mut() {
data.align_buffers()
}
}

Expand Down

0 comments on commit 4895ac8

Please sign in to comment.