From 10b672aa2e59ae3a26dd75c3905e9db1fb900f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Mon, 25 Nov 2024 16:33:44 +0100 Subject: [PATCH] WIP: re-apply codegen --- .../re_types/src/components/graph_edge.rs | 4 +-- .../re_types/src/components/graph_node.rs | 4 +-- .../re_types/src/components/graph_type.rs | 16 ++++++----- .../store/re_types/src/datatypes/utf8pair.rs | 28 ++++++++++--------- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/crates/store/re_types/src/components/graph_edge.rs b/crates/store/re_types/src/components/graph_edge.rs index 52da467cd38a..64dc08db7e52 100644 --- a/crates/store/re_types/src/components/graph_edge.rs +++ b/crates/store/re_types/src/components/graph_edge.rs @@ -68,8 +68,8 @@ impl std::ops::DerefMut for GraphEdge { impl ::re_types_core::Loggable for GraphEdge { #[inline] - fn arrow2_datatype() -> arrow2::datatypes::DataType { - crate::datatypes::Utf8Pair::arrow2_datatype() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8Pair::arrow_datatype() } fn to_arrow2_opt<'a>( diff --git a/crates/store/re_types/src/components/graph_node.rs b/crates/store/re_types/src/components/graph_node.rs index 8d838efb0639..5e42187423bc 100644 --- a/crates/store/re_types/src/components/graph_node.rs +++ b/crates/store/re_types/src/components/graph_node.rs @@ -68,8 +68,8 @@ impl std::ops::DerefMut for GraphNode { impl ::re_types_core::Loggable for GraphNode { #[inline] - fn arrow2_datatype() -> arrow2::datatypes::DataType { - crate::datatypes::Utf8::arrow2_datatype() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() } fn to_arrow2_opt<'a>( diff --git a/crates/store/re_types/src/components/graph_type.rs b/crates/store/re_types/src/components/graph_type.rs index b40ca0923f2f..38d5dd830701 100644 --- a/crates/store/re_types/src/components/graph_type.rs +++ b/crates/store/re_types/src/components/graph_type.rs @@ -71,9 +71,9 @@ impl std::fmt::Display for GraphType { impl ::re_types_core::Loggable for GraphType { #[inline] - fn arrow2_datatype() -> arrow2::datatypes::DataType { + fn arrow_datatype() -> arrow::datatypes::DataType { #![allow(clippy::wildcard_imports)] - use arrow2::datatypes::*; + use arrow::datatypes::*; DataType::UInt8 } @@ -86,7 +86,8 @@ impl ::re_types_core::Loggable for GraphType { #![allow(clippy::wildcard_imports)] #![allow(clippy::manual_is_variant_and)] use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, datatypes::*}; + use arrow::datatypes::*; + use arrow2::array::*; Ok({ let (somes, data0): (Vec<_>, Vec<_>) = data .into_iter() @@ -101,7 +102,7 @@ impl ::re_types_core::Loggable for GraphType { any_nones.then(|| somes.into()) }; PrimitiveArray::new( - Self::arrow2_datatype(), + Self::arrow_datatype().into(), data0.into_iter().map(|v| v.unwrap_or_default()).collect(), data0_bitmap, ) @@ -117,12 +118,13 @@ impl ::re_types_core::Loggable for GraphType { { #![allow(clippy::wildcard_imports)] use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, buffer::*, datatypes::*}; + use arrow::datatypes::*; + use arrow2::{array::*, buffer::*}; Ok(arrow_data .as_any() .downcast_ref::() .ok_or_else(|| { - let expected = Self::arrow2_datatype(); + let expected = Self::arrow_datatype(); let actual = arrow_data.data_type().clone(); DeserializationError::datatype_mismatch(expected, actual) }) @@ -134,7 +136,7 @@ impl ::re_types_core::Loggable for GraphType { Some(2) => Ok(Some(Self::Directed)), None => Ok(None), Some(invalid) => Err(DeserializationError::missing_union_arm( - Self::arrow2_datatype(), + Self::arrow_datatype(), "", invalid as _, )), diff --git a/crates/store/re_types/src/datatypes/utf8pair.rs b/crates/store/re_types/src/datatypes/utf8pair.rs index 5c0248d4726a..73105741330c 100644 --- a/crates/store/re_types/src/datatypes/utf8pair.rs +++ b/crates/store/re_types/src/datatypes/utf8pair.rs @@ -44,12 +44,12 @@ impl ::re_types_core::SizeBytes for Utf8Pair { impl ::re_types_core::Loggable for Utf8Pair { #[inline] - fn arrow2_datatype() -> arrow2::datatypes::DataType { + fn arrow_datatype() -> arrow::datatypes::DataType { #![allow(clippy::wildcard_imports)] - use arrow2::datatypes::*; - DataType::Struct(std::sync::Arc::new(vec![ - Field::new("first", ::arrow2_datatype(), false), - Field::new("second", ::arrow2_datatype(), false), + use arrow::datatypes::*; + DataType::Struct(Fields::from(vec![ + Field::new("first", ::arrow_datatype(), false), + Field::new("second", ::arrow_datatype(), false), ])) } @@ -62,7 +62,8 @@ impl ::re_types_core::Loggable for Utf8Pair { #![allow(clippy::wildcard_imports)] #![allow(clippy::manual_is_variant_and)] use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, datatypes::*}; + use arrow::datatypes::*; + use arrow2::array::*; Ok({ let (somes, data): (Vec<_>, Vec<_>) = data .into_iter() @@ -76,7 +77,7 @@ impl ::re_types_core::Loggable for Utf8Pair { any_nones.then(|| somes.into()) }; StructArray::new( - Self::arrow2_datatype(), + Self::arrow_datatype().into(), vec![ { let (somes, first): (Vec<_>, Vec<_>) = data @@ -106,7 +107,7 @@ impl ::re_types_core::Loggable for Utf8Pair { #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] unsafe { Utf8Array::::new_unchecked( - DataType::Utf8, + DataType::Utf8.into(), offsets, inner_data, first_bitmap, @@ -143,7 +144,7 @@ impl ::re_types_core::Loggable for Utf8Pair { #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] unsafe { Utf8Array::::new_unchecked( - DataType::Utf8, + DataType::Utf8.into(), offsets, inner_data, second_bitmap, @@ -167,13 +168,14 @@ impl ::re_types_core::Loggable for Utf8Pair { { #![allow(clippy::wildcard_imports)] use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, buffer::*, datatypes::*}; + use arrow::datatypes::*; + use arrow2::{array::*, buffer::*}; Ok({ let arrow_data = arrow_data .as_any() .downcast_ref::() .ok_or_else(|| { - let expected = Self::arrow2_datatype(); + let expected = Self::arrow_datatype(); let actual = arrow_data.data_type().clone(); DeserializationError::datatype_mismatch(expected, actual) }) @@ -191,7 +193,7 @@ impl ::re_types_core::Loggable for Utf8Pair { let first = { if !arrays_by_name.contains_key("first") { return Err(DeserializationError::missing_struct_field( - Self::arrow2_datatype(), + Self::arrow_datatype(), "first", )) .with_context("rerun.datatypes.Utf8Pair"); @@ -246,7 +248,7 @@ impl ::re_types_core::Loggable for Utf8Pair { let second = { if !arrays_by_name.contains_key("second") { return Err(DeserializationError::missing_struct_field( - Self::arrow2_datatype(), + Self::arrow_datatype(), "second", )) .with_context("rerun.datatypes.Utf8Pair");