Skip to content

Commit

Permalink
move
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-isaacs committed Dec 18, 2024
1 parent fb24c61 commit ba1ddf9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
11 changes: 10 additions & 1 deletion vortex-array/src/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::stats::{ArrayStatistics, Stat, Statistics, StatsSet};
use crate::stream::{ArrayStream, ArrayStreamAdapter};
use crate::validity::{ArrayValidity, LogicalValidity, ValidityVTable};
use crate::{
ArrayChildrenIterator, ArrayDType, ArrayLen, ArrayMetadata, Context,
ArrayChildrenIterator, ArrayDType, ArrayLen, ArrayMetadata, Context, NamedChildrenCollector,
TryDeserializeArrayMetadata,
};

Expand Down Expand Up @@ -219,6 +219,15 @@ impl ArrayData {
}
}

/// Returns a Vec of Arrays with all the array's child arrays.
pub fn named_children(&self) -> Vec<(String, ArrayData)> {
let mut collector = NamedChildrenCollector::default();
self.encoding()
.accept(&ArrayData::from(self.clone()), &mut collector)
.vortex_expect("Failed to get children");
collector.children()
}

/// Returns the number of child arrays
pub fn nchildren(&self) -> usize {
match &self.0 {
Expand Down
4 changes: 2 additions & 2 deletions vortex-array/src/data/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use std::sync::{Arc, RwLock};

use vortex_buffer::Buffer;
use vortex_dtype::DType;
use vortex_error::{vortex_bail, vortex_panic, VortexResult};
use vortex_error::{vortex_bail, vortex_panic, VortexExpect, VortexResult};
use vortex_scalar::Scalar;

use crate::encoding::EncodingRef;
use crate::stats::{Stat, Statistics, StatsSet};
use crate::{ArrayDType, ArrayData, ArrayMetadata};
use crate::{ArrayDType, ArrayData, ArrayMetadata, NamedChildrenCollector};

/// Owned [`ArrayData`] with serialized metadata, backed by heap-allocated memory.
#[derive(Clone, Debug)]
Expand Down
9 changes: 0 additions & 9 deletions vortex-array/src/data/viewed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,6 @@ impl ViewedArrayData {
collector.children()
}

#[allow(dead_code)]
pub fn named_children(&self) -> Vec<(String, ArrayData)> {
let mut collector = NamedChildrenCollector::default();
self.encoding
.accept(&ArrayData::from(self.clone()), &mut collector)
.vortex_expect("Failed to get children");
collector.children()
}

pub fn buffer(&self) -> Option<&Buffer> {
self.flatbuffer()
.buffers()
Expand Down

0 comments on commit ba1ddf9

Please sign in to comment.