Skip to content

Commit

Permalink
Call it to_arrow2 where it makes sense
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Nov 21, 2024
1 parent 20f72ed commit e065cb8
Show file tree
Hide file tree
Showing 31 changed files with 158 additions and 158 deletions.
6 changes: 3 additions & 3 deletions crates/store/re_chunk/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl ChunkBuilder {
row_id,
timepoint,
component_batch
.to_arrow()
.to_arrow2()
.ok()
.map(|array| (component_batch.name(), array)),
)
Expand All @@ -165,7 +165,7 @@ impl ChunkBuilder {
timepoint,
component_batches.into_iter().filter_map(|component_batch| {
component_batch
.to_arrow()
.to_arrow2()
.ok()
.map(|array| (component_batch.name(), array))
}),
Expand All @@ -188,7 +188,7 @@ impl ChunkBuilder {
.map(|(component_name, component_batch)| {
(
component_name,
component_batch.and_then(|batch| batch.to_arrow().ok()),
component_batch.and_then(|batch| batch.to_arrow2().ok()),
)
}),
)
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_chunk/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ impl Chunk {
) -> ChunkResult<Self> {
re_tracing::profile_function!();
let row_ids = row_ids
.to_arrow()
.to_arrow2()
// NOTE: impossible, but better safe than sorry.
.map_err(|err| ChunkError::Malformed {
reason: format!("RowIds failed to serialize: {err}"),
Expand Down
4 changes: 2 additions & 2 deletions crates/store/re_chunk/src/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,9 +768,9 @@ mod tests {
let timepoint2 = [(Timeline::new_sequence("frame"), 2)];

let points32bit =
<MyPoint as re_types_core::LoggableBatch>::to_arrow(&MyPoint::new(1.0, 1.0))?;
<MyPoint as re_types_core::LoggableBatch>::to_arrow2(&MyPoint::new(1.0, 1.0))?;
let points64bit =
<MyPoint64 as re_types_core::LoggableBatch>::to_arrow(&MyPoint64::new(1.0, 1.0))?;
<MyPoint64 as re_types_core::LoggableBatch>::to_arrow2(&MyPoint64::new(1.0, 1.0))?;

let chunk1 = Chunk::builder(entity_path.into())
.with_row(
Expand Down
20 changes: 10 additions & 10 deletions crates/store/re_chunk/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,8 +984,8 @@ mod tests {

assert!(!chunk.is_sorted());
for (row_id, component_name, expected) in expectations {
let expected =
expected.and_then(|expected| re_types_core::LoggableBatch::to_arrow(expected).ok());
let expected = expected
.and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok());
eprintln!("{component_name} @ {row_id}");
similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name));
}
Expand All @@ -994,8 +994,8 @@ mod tests {
assert!(chunk.is_sorted());

for (row_id, component_name, expected) in expectations {
let expected =
expected.and_then(|expected| re_types_core::LoggableBatch::to_arrow(expected).ok());
let expected = expected
.and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok());
eprintln!("{component_name} @ {row_id}");
similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name));
}
Expand Down Expand Up @@ -1113,7 +1113,7 @@ mod tests {

for (row_id, component_name, expected) in expectations {
let expected = expected
.and_then(|expected| re_types_core::LoggableBatch::to_arrow(expected).ok());
.and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok());
eprintln!("{component_name} @ {row_id}");
similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name));
}
Expand Down Expand Up @@ -1144,7 +1144,7 @@ mod tests {

for (row_id, component_name, expected) in expectations {
let expected = expected
.and_then(|expected| re_types_core::LoggableBatch::to_arrow(expected).ok());
.and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok());
eprintln!("{component_name} @ {row_id}");
similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name));
}
Expand Down Expand Up @@ -1240,7 +1240,7 @@ mod tests {

for (row_id, component_name, expected) in expectations {
let expected = expected
.and_then(|expected| re_types_core::LoggableBatch::to_arrow(expected).ok());
.and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok());
eprintln!("{component_name} @ {row_id}");
similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name));
}
Expand All @@ -1259,7 +1259,7 @@ mod tests {

for (row_id, component_name, expected) in expectations {
let expected = expected
.and_then(|expected| re_types_core::LoggableBatch::to_arrow(expected).ok());
.and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok());
eprintln!("{component_name} @ {row_id}");
similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name));
}
Expand Down Expand Up @@ -1386,7 +1386,7 @@ mod tests {

for (row_id, component_name, expected) in expectations {
let expected = expected
.and_then(|expected| re_types_core::LoggableBatch::to_arrow(expected).ok());
.and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok());
eprintln!("{component_name} @ {row_id}");
similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name));
}
Expand Down Expand Up @@ -1533,7 +1533,7 @@ mod tests {

for (row_id, component_name, expected) in expectations {
let expected = expected
.and_then(|expected| re_types_core::LoggableBatch::to_arrow(expected).ok());
.and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok());
eprintln!("{component_name} @ {row_id}");
similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name));
}
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/annotation_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn roundtrip() {
[("context", vec!["rerun.components.AnnotationContext"])].into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/arrows3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/asset3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn roundtrip() {
// .into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/box2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/box3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn roundtrip() {
similar_asserts::assert_eq!(expected, arch);

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/depth_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn depth_image_roundtrip() {
DepthImage::try_from(ndarray::array![[1u8, 2, 3], [4, 5, 6]])
.unwrap()
.with_meter(1000.0)
.to_arrow()
.to_arrow2()
.unwrap(),
];

Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/disconnected_space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn roundtrip() {
similar_asserts::assert_eq!(expected, arch);

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
8 changes: 4 additions & 4 deletions crates/store/re_types/tests/types/fuzzy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down Expand Up @@ -309,7 +309,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down Expand Up @@ -362,7 +362,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down Expand Up @@ -415,7 +415,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/line_strips2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/line_strips3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/mesh3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/pinhole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/points2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/points3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/segmentation_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn segmentation_image_roundtrip() {
[4, 5, 6]
])
.unwrap()
.to_arrow()
.to_arrow2()
.unwrap()];

let expected_extensions: HashMap<_, _> = [("data", vec!["rerun.components.Blob"])].into();
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn tensor_roundtrip() {

let all_arch_serialized = [Tensor::try_from(ndarray::array![[1u8, 2, 3], [4, 5, 6]])
.unwrap()
.to_arrow()
.to_arrow2()
.unwrap()];

let expected_extensions: HashMap<_, _> = [("data", vec!["rerun.components.TensorData"])].into();
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/text_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn roundtrip() {
.into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/transform3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn roundtrip() {
similar_asserts::assert_eq!(expected, arch);

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/types/view_coordinates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn roundtrip() {
[("coordinates", vec!["rerun.components.ViewCoordinates"])].into();

eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
let serialized = arch.to_arrow2().unwrap();
for (field, array) in &serialized {
// NOTE: Keep those around please, very useful when debugging.
// eprintln!("field = {field:#?}");
Expand Down
6 changes: 3 additions & 3 deletions crates/store/re_types_core/src/archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl<A: Archetype> Default for GenericIndicatorComponent<A> {

impl<A: Archetype> crate::LoggableBatch for GenericIndicatorComponent<A> {
#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn arrow2::array::Array>> {
fn to_arrow2(&self) -> SerializationResult<Box<dyn arrow2::array::Array>> {
let datatype = arrow2::datatypes::DataType::Null;
Ok(arrow2::array::NullArray::new(datatype, 1).boxed())
}
Expand Down Expand Up @@ -247,7 +247,7 @@ pub struct GenericIndicatorComponentArray<A: Archetype> {

impl<A: Archetype> crate::LoggableBatch for GenericIndicatorComponentArray<A> {
#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn arrow2::array::Array>> {
fn to_arrow2(&self) -> SerializationResult<Box<dyn arrow2::array::Array>> {
let datatype = arrow2::datatypes::DataType::Null;
Ok(arrow2::array::NullArray::new(datatype, self.len).boxed())
}
Expand Down Expand Up @@ -282,7 +282,7 @@ impl NamedIndicatorComponent {

impl crate::LoggableBatch for NamedIndicatorComponent {
#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn arrow2::array::Array>> {
fn to_arrow2(&self) -> SerializationResult<Box<dyn arrow2::array::Array>> {
let datatype = arrow2::datatypes::DataType::Null;
Ok(arrow2::array::NullArray::new(datatype, 1).boxed())
}
Expand Down
4 changes: 2 additions & 2 deletions crates/store/re_types_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub trait AsComponents {
/// The default implementation will simply serialize the result of [`Self::as_component_batches`]
/// as-is, which is what you want in 99.9% of cases.
#[inline]
fn to_arrow(
fn to_arrow2(
&self,
) -> SerializationResult<Vec<(::arrow2::datatypes::Field, Box<dyn ::arrow2::array::Array>)>>
{
Expand All @@ -67,7 +67,7 @@ pub trait AsComponents {
.map(|comp_batch| {
comp_batch
.as_ref()
.to_arrow()
.to_arrow2()
.map(|array| {
let field = arrow2::datatypes::Field::new(
comp_batch.name().to_string(),
Expand Down
Loading

0 comments on commit e065cb8

Please sign in to comment.