Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy re_components #3440

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 2 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ re_arrow_store = { path = "crates/re_arrow_store", version = "=0.9.0-alpha.4", d
re_build_info = { path = "crates/re_build_info", version = "=0.9.0-alpha.4", default-features = false }
re_build_tools = { path = "crates/re_build_tools", version = "=0.9.0-alpha.4", default-features = false }
re_build_web_viewer = { path = "crates/re_build_web_viewer", version = "=0.9.0-alpha.4", default-features = false }
re_components = { path = "crates/re_components", version = "=0.9.0-alpha.4", default-features = false }
re_crash_handler = { path = "crates/re_crash_handler", version = "=0.9.0-alpha.4", default-features = false }
re_data_source = { path = "crates/re_data_source", version = "=0.9.0-alpha.4", default-features = false }
re_data_store = { path = "crates/re_data_store", version = "=0.9.0-alpha.4", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/re_arrow_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ polars-ops = { workspace = true, optional = true, features = [


[dev-dependencies]
re_components = { workspace = true, features = ["arrow_datagen"] }
re_types = { workspace = true, features = ["datagen"] }

anyhow.workspace = true
criterion = "0.5"
Expand Down
3 changes: 2 additions & 1 deletion crates/re_arrow_store/benches/arrow2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ use std::sync::Arc;
use arrow2::array::{Array, PrimitiveArray, StructArray, UnionArray};
use criterion::{criterion_group, Criterion};
use itertools::Itertools;
use re_components::datagen::{build_some_instances, build_some_positions2d};

use re_log_types::{DataCell, SizeBytes as _};
use re_types::datagen::{build_some_instances, build_some_positions2d};
use re_types::{
components::{InstanceKey, Position2D},
testing::{build_some_large_structs, LargeStruct},
Expand Down
6 changes: 4 additions & 2 deletions crates/re_arrow_store/benches/data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ use re_arrow_store::{
DataStore, DataStoreConfig, GarbageCollectionOptions, GarbageCollectionTarget, LatestAtQuery,
RangeQuery, TimeInt, TimeRange,
};
use re_components::datagen::{build_frame_nr, build_some_instances};
use re_log_types::{DataCell, DataRow, DataTable, EntityPath, RowId, TableId, TimeType, Timeline};
use re_log_types::{
build_frame_nr, DataCell, DataRow, DataTable, EntityPath, RowId, TableId, TimeType, Timeline,
};
use re_types::datagen::build_some_instances;
use re_types::{
components::InstanceKey,
testing::{build_some_large_structs, LargeStruct},
Expand Down
7 changes: 2 additions & 5 deletions crates/re_arrow_store/examples/dump_dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
//! ```

use re_arrow_store::{test_row, DataStore};
use re_components::datagen::{
build_frame_nr, build_log_time, build_some_instances, build_some_instances_from,
build_some_positions2d,
};
use re_log_types::{EntityPath, Time};
use re_log_types::{build_frame_nr, build_log_time, EntityPath, Time};
use re_types::datagen::{build_some_instances, build_some_instances_from, build_some_positions2d};
use re_types::{components::InstanceKey, testing::build_some_large_structs, Loggable};

// ---
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/examples/latest_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use re_arrow_store::polars_util::latest_component;
use re_arrow_store::{test_row, DataStore, LatestAtQuery, TimeType, Timeline};
use re_components::datagen::{build_frame_nr, build_some_positions2d};
use re_log_types::EntityPath;
use re_log_types::{build_frame_nr, EntityPath};
use re_types::datagen::build_some_positions2d;
use re_types::{
components::{InstanceKey, Position2D},
testing::{build_some_large_structs, LargeStruct},
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/examples/latest_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use polars_core::prelude::*;

use re_arrow_store::polars_util::latest_components;
use re_arrow_store::{test_row, DataStore, LatestAtQuery, TimeType, Timeline};
use re_components::datagen::{build_frame_nr, build_some_positions2d};
use re_log_types::EntityPath;
use re_log_types::{build_frame_nr, EntityPath};
use re_types::datagen::build_some_positions2d;
use re_types::{
components::{InstanceKey, Position2D},
testing::{build_some_large_structs, LargeStruct},
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/examples/range_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use polars_core::prelude::JoinType;
use re_arrow_store::{polars_util, test_row, DataStore, RangeQuery, TimeRange};
use re_components::datagen::{build_frame_nr, build_some_positions2d};
use re_log_types::{EntityPath, TimeType, Timeline};
use re_log_types::{build_frame_nr, EntityPath, TimeType, Timeline};
use re_types::datagen::build_some_positions2d;
use re_types::{
components::{InstanceKey, Position2D},
testing::{build_some_large_structs, LargeStruct},
Expand Down
91 changes: 25 additions & 66 deletions crates/re_arrow_store/src/arrow_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,82 +224,41 @@ impl ArrayExt for dyn Array {

#[test]
fn test_clean_for_polars_nomodify() {
use re_components::datagen::build_some_colors;
use re_log_types::DataCell;
use re_types::datagen::build_some_colors;

// Colors don't need polars cleaning
let cell: DataCell = build_some_colors(5).try_into().unwrap();
let cleaned = cell.as_arrow_ref().clean_for_polars();
assert_eq!(cell.as_arrow_ref(), &*cleaned);
}

#[cfg(test)]
mod tests {
use arrow2::datatypes::{DataType, Field, UnionMode};
use arrow2_convert::{ArrowDeserialize, ArrowField, ArrowSerialize};
use re_components::FixedSizeArrayField;
use re_log_types::DataCell;

use crate::ArrayExt;

#[derive(
Copy, Clone, Debug, Default, PartialEq, ArrowField, ArrowSerialize, ArrowDeserialize,
)]
#[arrow_field(transparent)]
pub struct Vec3D(#[arrow_field(type = "FixedSizeArrayField<f32,3>")] pub [f32; 3]);

#[derive(Clone, Copy, Debug, PartialEq, ArrowField, ArrowSerialize, ArrowDeserialize)]
#[arrow_field(type = "dense")]
enum TestComponentWithUnionAndFixedSizeList {
Bool(bool),
Vec3D(Vec3D),
}

re_log_types::component_legacy_shim!(TestComponentWithUnionAndFixedSizeList);
#[cfg(feature = "polars")]
crate::polars_util::dataframe_from_cells(&[Some(cell)]).unwrap();
}

impl re_log_types::LegacyComponent for TestComponentWithUnionAndFixedSizeList {
fn legacy_name() -> re_log_types::ComponentName {
"test_component_with_union_and_fixed_size_list".into()
}
}
#[test]
fn test_clean_for_polars_modify() {
use std::f32::consts::PI;

#[test]
fn test_clean_for_polars_modify() {
// Pick a type with both Unions and FixedSizeLists
let elements = vec![TestComponentWithUnionAndFixedSizeList::Bool(false)];
use re_log_types::DataCell;
use re_types::components::Transform3D;
use re_types::datatypes::{
Angle, RotationAxisAngle, Scale3D, TranslationAndMat3x3, TranslationRotationScale3D,
};

let cell: DataCell = elements.try_into().unwrap();
assert_eq!(
*cell.datatype(),
DataType::Union(
vec![
Field::new("Bool", DataType::Boolean, false),
Field::new(
"Vec3D",
DataType::FixedSizeList(
Box::new(Field::new("item", DataType::Float32, false)),
3
),
false
)
],
None,
UnionMode::Dense
)
);
let cell = DataCell::try_from_native([
Transform3D::new(TranslationAndMat3x3::translation([1.0, 0.0, 0.0])), //
Transform3D::new(TranslationRotationScale3D {
rotation: Some(RotationAxisAngle::new([0.0, 0.0, 1.0], Angle::Radians(PI / 4.)).into()),
scale: Some(Scale3D::from(2.0)),
..Default::default()
}),
])
.unwrap();

let cleaned = cell.as_arrow_ref().clean_for_polars();
let cleaned = cell.as_arrow_ref().clean_for_polars();
assert_ne!(cell.as_arrow_ref(), &*cleaned);

assert_eq!(
*cleaned.data_type(),
DataType::Struct(vec![
Field::new("Bool", DataType::Boolean, false),
Field::new(
"Vec3D",
DataType::List(Box::new(Field::new("item", DataType::Float32, false))),
false
)
],)
);
}
#[cfg(feature = "polars")]
crate::polars_util::dataframe_from_cells(&[Some(cell)]).unwrap();
}