From e5ee1e16fce6b592d2138c91cd80db7a8cca3c29 Mon Sep 17 00:00:00 2001 From: Christopher Prohm Date: Wed, 11 Sep 2024 21:58:40 +0200 Subject: [PATCH] Revert Copy change to support previous Arrow versions --- serde_arrow/src/arrow_impl/schema.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/serde_arrow/src/arrow_impl/schema.rs b/serde_arrow/src/arrow_impl/schema.rs index 064e291d..2e3da229 100644 --- a/serde_arrow/src/arrow_impl/schema.rs +++ b/serde_arrow/src/arrow_impl/schema.rs @@ -141,13 +141,27 @@ impl TryFrom<&ArrowDataType> for DataType { AT::Date32 => Ok(T::Date32), AT::Date64 => Ok(T::Date64), AT::Decimal128(precision, scale) => Ok(T::Decimal128(*precision, *scale)), - AT::Time32(unit) => Ok(T::Time32((*unit).into())), - AT::Time64(unit) => Ok(T::Time64((*unit).into())), + AT::Time32(unit) => Ok(T::Time32( + // only some arrow version implement Copy for unit + #[allow(clippy::clone_on_copy)] + unit.clone().into(), + )), + AT::Time64(unit) => Ok(T::Time64( + // only some arrow version implement Copy for unit + #[allow(clippy::clone_on_copy)] + unit.clone().into(), + )), AT::Timestamp(unit, tz) => Ok(T::Timestamp( - (*unit).into(), + // only some arrow version implement Copy for unit + #[allow(clippy::clone_on_copy)] + unit.clone().into(), tz.as_ref().map(|s| s.to_string()), )), - AT::Duration(unit) => Ok(T::Duration((*unit).into())), + AT::Duration(unit) => Ok(T::Duration( + // only some arrow version implement Copy for unit + #[allow(clippy::clone_on_copy)] + unit.clone().into(), + )), AT::Binary => Ok(T::Binary), AT::LargeBinary => Ok(T::LargeBinary), AT::FixedSizeBinary(n) => Ok(T::FixedSizeBinary(*n)),