Skip to content

Commit

Permalink
Less arrow2
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Dec 18, 2024
1 parent 512a671 commit 9bd7052
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 25 deletions.
8 changes: 4 additions & 4 deletions crates/store/re_chunk/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl ChunkBuilder {

/// Add a row's worth of data using the given component data.
#[inline]
pub fn with_row_arrow1(
pub fn with_row(
self,
row_id: RowId,
timepoint: impl Into<TimePoint>,
Expand All @@ -119,7 +119,7 @@ impl ChunkBuilder {

/// Add a row's worth of data using the given component data.
#[inline]
pub fn with_row(
pub fn with_row_arrow2(
self,
row_id: RowId,
timepoint: impl Into<TimePoint>,
Expand Down Expand Up @@ -160,7 +160,7 @@ impl ChunkBuilder {
timepoint: impl Into<TimePoint>,
component_batch: &dyn ComponentBatch,
) -> Self {
self.with_row(
self.with_row_arrow2(
row_id,
timepoint,
component_batch
Expand All @@ -178,7 +178,7 @@ impl ChunkBuilder {
timepoint: impl Into<TimePoint>,
component_batches: impl IntoIterator<Item = &'a dyn ComponentBatch>,
) -> Self {
self.with_row(
self.with_row_arrow2(
row_id,
timepoint,
component_batches.into_iter().filter_map(|component_batch| {
Expand Down
1 change: 1 addition & 0 deletions crates/store/re_chunk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub use re_log_types::{EntityPath, TimeInt, TimePoint, Timeline, TimelineName};
pub use re_types_core::{ArchetypeFieldName, ArchetypeName, ComponentName};

pub mod external {
pub use arrow;
pub use arrow2;
pub use nohash_hasher;

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 @@ -804,7 +804,7 @@ mod tests {
<MyPoint64 as re_types_core::LoggableBatch>::to_arrow2(&MyPoint64::new(1.0, 1.0))?;

let chunk1 = Chunk::builder(entity_path.into())
.with_row(
.with_row_arrow2(
row_id1,
timepoint1,
[
Expand All @@ -814,7 +814,7 @@ mod tests {
.build()?;

let chunk2 = Chunk::builder(entity_path.into())
.with_row(
.with_row_arrow2(
row_id2,
timepoint2,
[
Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_data_ui/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl DataUi for ComponentPathLatestAtResults<'_> {

let Some(num_instances) = self
.unit
.component_batch_raw_arrow2(component_name)
.component_batch_raw(component_name)
.map(|data| data.len())
else {
ui.weak("<pending>");
Expand Down
7 changes: 2 additions & 5 deletions crates/viewer/re_selection_panel/src/defaults_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ fn active_defaults(
db.storage_engine()
.cache()
.latest_at(query, &view.defaults_path, [*c])
.component_batch_raw_arrow2(c)
.component_batch_raw(c)
.map_or(false, |data| !data.is_empty())
})
.collect::<BTreeSet<_>>()
Expand Down Expand Up @@ -304,10 +304,7 @@ fn add_popup_ui(
.with_row(
RowId::new(),
ctx.blueprint_timepoint_for_writes(),
[(
ComponentDescriptor::new(component_name),
initial_data.into(),
)],
[(ComponentDescriptor::new(component_name), initial_data)],
)
.build()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ pub fn show_labels_fallback<C: Component>(ctx: &re_viewer_context::QueryContext<
ctx.recording()
.latest_at(ctx.query, ctx.target_entity_path, [C::name(), Text::name()]);
let num_instances = results
.component_batch_raw_arrow2(&C::name())
.component_batch_raw(&C::name())
.map_or(0, |array| array.len());
let num_labels = results
.component_batch_raw_arrow2(&Text::name())
.component_batch_raw(&Text::name())
.map_or(0, |array| array.len());

ShowLabels::from(num_labels == 1 || num_instances < MAX_NUM_LABELS_PER_ENTITY)
Expand Down
4 changes: 2 additions & 2 deletions crates/viewer/re_viewer/src/blueprint/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ pub(crate) fn validate_component<C: Component>(blueprint: &EntityDb) -> bool {
if let Some(array) = engine
.cache()
.latest_at(&query, path, [C::name()])
.component_batch_raw_arrow2(&C::name())
.component_batch_raw(&C::name())
{
if let Err(err) = C::from_arrow2_opt(&*array) {
if let Err(err) = C::from_arrow_opt(&*array) {
re_log::debug!(
"Failed to deserialize component {:?}: {:?}",
C::name(),
Expand Down
6 changes: 3 additions & 3 deletions crates/viewer/re_viewer_context/src/blueprint_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl ViewerContext<'_> {
let timepoint = self.store_context.blueprint_timepoint_for_writes();

let chunk = match Chunk::builder(entity_path.clone())
.with_row_arrow1(
.with_row(
RowId::new(),
timepoint.clone(),
[(ComponentDescriptor::new(component_name), array)],
Expand Down Expand Up @@ -165,7 +165,7 @@ impl ViewerContext<'_> {
.latest_at(self.blueprint_query, entity_path, [component_name])
.get(&component_name)
.and_then(|unit| {
unit.component_batch_raw_arrow2(&component_name)
unit.component_batch_raw(&component_name)
.map(|array| array.data_type().clone())
})
else {
Expand All @@ -180,7 +180,7 @@ impl ViewerContext<'_> {
timepoint,
[(
ComponentDescriptor::new(component_name),
re_chunk::external::arrow2::array::new_empty_array(datatype),
re_chunk::external::arrow::array::new_empty_array(&datatype),
)],
)
.build();
Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_viewer_context/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ pub fn resolve_mono_instance_path(
&instance.entity_path,
[ComponentDescriptor::new(component_name)],
)
.component_batch_raw_arrow2(&component_name)
.component_batch_raw(&component_name)
{
if array.len() > 1 {
return instance.clone();
Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_viewport_blueprint/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl ViewBlueprint {
let array = blueprint_engine
.cache()
.latest_at(query, path, [component_name])
.component_batch_raw_arrow2(&component_name);
.component_batch_raw(&component_name);
array.map(|array| (ComponentDescriptor::new(component_name), array))
}),
)
Expand Down
4 changes: 2 additions & 2 deletions crates/viewer/re_viewport_blueprint/src/view_contents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ impl DataQueryPropertyResolver<'_> {
.storage_engine()
.cache()
.latest_at(blueprint_query, &recursive_override_path, [component_name])
.component_batch_raw_arrow2(&component_name)
.component_batch_raw(&component_name)
{
if !component_data.is_empty() {
recursive_property_overrides.to_mut().insert(
Expand Down Expand Up @@ -522,7 +522,7 @@ impl DataQueryPropertyResolver<'_> {
.storage_engine()
.cache()
.latest_at(blueprint_query, &individual_override_path, [component_name])
.component_batch_raw_arrow2(&component_name)
.component_batch_raw(&component_name)
{
if !component_data.is_empty() {
resolved_component_overrides.insert(
Expand Down
4 changes: 2 additions & 2 deletions examples/rust/extend_viewer_ui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ fn component_ui(

let num_instances = data.len();
for i in 0..num_instances {
ui.label(format_arrow(&*data.sliced(i, 1)));
ui.label(format_arrow2(&*data.sliced(i, 1)));
}
});
};
}

fn format_arrow(value: &dyn arrow2::array::Array) -> String {
fn format_arrow2(value: &dyn arrow2::array::Array) -> String {
use re_types::SizeBytes as _;

let bytes = value.total_size_bytes();
Expand Down

0 comments on commit 9bd7052

Please sign in to comment.