Skip to content

Commit

Permalink
Port TransportChunk to arrow-rs (#8700)
Browse files Browse the repository at this point in the history
* Part of #3741 
* [x] Tested that it does not regress
#8668

This makes `TransportChunk` a wrapper around an arrow `RecordBatch`.

### Future work
* Remove `TransportChunk` and replace it with an extension trait on
`RecordBatch`
* Simplify the dataframe API to always return a full `RecordBatch`
(adding a schema to the rows is basically free now)
  • Loading branch information
emilk authored Jan 16, 2025
1 parent 2e1a59e commit e99a507
Show file tree
Hide file tree
Showing 25 changed files with 441 additions and 560 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5921,6 +5921,7 @@ dependencies = [
"re_arrow_util",
"re_chunk",
"re_chunk_store",
"re_format_arrow",
"re_log",
"re_log_encoding",
"re_log_types",
Expand Down Expand Up @@ -7322,6 +7323,7 @@ name = "rerun"
version = "0.22.0-alpha.1+dev"
dependencies = [
"anyhow",
"arrow",
"clap",
"document-features",
"env_logger",
Expand All @@ -7342,6 +7344,7 @@ dependencies = [
"re_entity_db",
"re_error",
"re_format",
"re_format_arrow",
"re_log",
"re_log_encoding",
"re_log_types",
Expand Down
3 changes: 0 additions & 3 deletions crates/store/re_chunk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ serde = [
"re_types_core/serde",
]

## Enable conversion to and from arrow-rs types
arrow = ["arrow2/arrow"]


[dependencies]

Expand Down
40 changes: 0 additions & 40 deletions crates/store/re_chunk/src/arrow.rs

This file was deleted.

18 changes: 17 additions & 1 deletion crates/store/re_chunk/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,13 +956,29 @@ impl Chunk {
}
}

/// Unconditionally inserts an [`Arrow2ListArray`] as a component column.
/// Unconditionally inserts an [`ArrowListArray`] as a component column.
///
/// Removes and replaces the column if it already exists.
///
/// This will fail if the end result is malformed in any way -- see [`Self::sanity_check`].
#[inline]
pub fn add_component(
&mut self,
component_desc: ComponentDescriptor,
list_array: ArrowListArray,
) -> ChunkResult<()> {
self.components
.insert_descriptor(component_desc, list_array);
self.sanity_check()
}

/// Unconditionally inserts an [`Arrow2ListArray`] as a component column.
///
/// Removes and replaces the column if it already exists.
///
/// This will fail if the end result is malformed in any way -- see [`Self::sanity_check`].
#[inline]
pub fn add_component_arrow2(
&mut self,
component_desc: ComponentDescriptor,
list_array: Arrow2ListArray<i32>,
Expand Down
40 changes: 0 additions & 40 deletions crates/store/re_chunk/src/concat_record_batches.rs

This file was deleted.

4 changes: 0 additions & 4 deletions crates/store/re_chunk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
mod builder;
mod chunk;
pub mod concat_record_batches;
mod helpers;
mod id;
mod iter;
Expand All @@ -21,9 +20,6 @@ mod transport;
#[cfg(not(target_arch = "wasm32"))]
mod batcher;

#[cfg(feature = "arrow")]
mod arrow;

pub use self::builder::{ChunkBuilder, TimeColumnBuilder};
pub use self::chunk::{
Chunk, ChunkComponents, ChunkError, ChunkResult, TimeColumn, TimeColumnError,
Expand Down
Loading

0 comments on commit e99a507

Please sign in to comment.