Skip to content

Commit 27b1825

Browse files
authored
make all scalar view types Copy (#7673)
## Summary Closes: #4844 ## API Changes Adds `Copy` impl for all scalar view types. ## Testing N/A Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 85e95fc commit 27b1825

8 files changed

Lines changed: 19 additions & 7 deletions

File tree

encodings/sparse/src/canonical.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ fn execute_sparse_lists_inner<I: IntegerPType, O: IntegerPType>(
214214
} else {
215215
// Set with the fill value.
216216
builder
217-
.append_value(fill_value.clone())
217+
.append_value(fill_value)
218218
.vortex_expect("Failed to append fill value");
219219
}
220220
}

vortex-array/public-api.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14248,6 +14248,8 @@ impl<'a> core::hash::Hash for vortex_array::scalar::BinaryScalar<'a>
1424814248

1424914249
pub fn vortex_array::scalar::BinaryScalar<'a>::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
1425014250

14251+
impl<'a> core::marker::Copy for vortex_array::scalar::BinaryScalar<'a>
14252+
1425114253
pub struct vortex_array::scalar::BoolScalar<'a>
1425214254

1425314255
impl<'a> vortex_array::scalar::BoolScalar<'a>
@@ -14298,6 +14300,8 @@ impl<'a> core::hash::Hash for vortex_array::scalar::BoolScalar<'a>
1429814300

1429914301
pub fn vortex_array::scalar::BoolScalar<'a>::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
1430014302

14303+
impl<'a> core::marker::Copy for vortex_array::scalar::BoolScalar<'a>
14304+
1430114305
pub struct vortex_array::scalar::DecimalScalar<'a>
1430214306

1430314307
impl<'a> vortex_array::scalar::DecimalScalar<'a>
@@ -14464,6 +14468,8 @@ impl<'a> core::fmt::Debug for vortex_array::scalar::ExtScalar<'a>
1446414468

1446514469
pub fn vortex_array::scalar::ExtScalar<'a>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1446614470

14471+
impl<'a> core::marker::Copy for vortex_array::scalar::ExtScalar<'a>
14472+
1446714473
pub struct vortex_array::scalar::ListScalar<'a>
1446814474

1446914475
impl<'a> vortex_array::scalar::ListScalar<'a>
@@ -14516,6 +14522,8 @@ impl<'a> core::fmt::Debug for vortex_array::scalar::ListScalar<'a>
1451614522

1451714523
pub fn vortex_array::scalar::ListScalar<'a>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1451814524

14525+
impl<'a> core::marker::Copy for vortex_array::scalar::ListScalar<'a>
14526+
1451914527
pub struct vortex_array::scalar::PrimitiveScalar<'a>
1452014528

1452114529
impl<'a> vortex_array::scalar::PrimitiveScalar<'a>
@@ -15310,6 +15318,8 @@ impl<'a> core::fmt::Debug for vortex_array::scalar::StructScalar<'a>
1531015318

1531115319
pub fn vortex_array::scalar::StructScalar<'a>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1531215320

15321+
impl<'a> core::marker::Copy for vortex_array::scalar::StructScalar<'a>
15322+
1531315323
pub struct vortex_array::scalar::Utf8Scalar<'a>
1531415324

1531515325
impl<'a> vortex_array::scalar::Utf8Scalar<'a>
@@ -15360,6 +15370,8 @@ impl<'a> core::hash::Hash for vortex_array::scalar::Utf8Scalar<'a>
1536015370

1536115371
pub fn vortex_array::scalar::Utf8Scalar<'a>::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
1536215372

15373+
impl<'a> core::marker::Copy for vortex_array::scalar::Utf8Scalar<'a>
15374+
1536315375
pub struct vortex_array::scalar::VariantScalar<'a>
1536415376

1536515377
impl<'a> vortex_array::scalar::VariantScalar<'a>

vortex-array/src/scalar/typed_view/binary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::scalar::ScalarValue;
2020
///
2121
/// This type provides a view into a binary scalar value, which can be either
2222
/// a valid byte buffer or null.
23-
#[derive(Debug, Clone, Hash)]
23+
#[derive(Debug, Clone, Copy, Hash)]
2424
pub struct BinaryScalar<'a> {
2525
/// The data type of this scalar.
2626
dtype: &'a DType,

vortex-array/src/scalar/typed_view/bool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::scalar::ScalarValue;
1919
///
2020
/// This type provides a view into a boolean scalar value, which can be either
2121
/// true, false, or null.
22-
#[derive(Debug, Clone, Hash, Eq)]
22+
#[derive(Debug, Clone, Copy, Hash, Eq)]
2323
pub struct BoolScalar<'a> {
2424
/// The data type of this scalar.
2525
dtype: &'a DType,

vortex-array/src/scalar/typed_view/extension/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::scalar::ScalarValue;
1919
/// A scalar value representing an extension type.
2020
///
2121
/// Extension types allow wrapping a storage type with custom semantics.
22-
#[derive(Debug, Clone)]
22+
#[derive(Debug, Clone, Copy)]
2323
pub struct ExtScalar<'a> {
2424
/// A reference to the `DType` of the extension type. This **must** be the [`DType::Extension`]
2525
/// variant.

vortex-array/src/scalar/typed_view/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::scalar::ScalarValue;
2929
/// number of `elements` is equal to the `size` field of the [`FixedSizeList`].
3030
///
3131
/// [`FixedSizeList`]: DType::FixedSizeList
32-
#[derive(Debug, Clone)]
32+
#[derive(Debug, Clone, Copy)]
3333
pub struct ListScalar<'a> {
3434
/// The data type of this scalar.
3535
dtype: &'a DType,

vortex-array/src/scalar/typed_view/struct_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::scalar::ScalarValue;
2727
///
2828
/// This type provides a view into a struct scalar value, which can contain
2929
/// named fields with different types, or be null.
30-
#[derive(Debug, Clone)]
30+
#[derive(Debug, Clone, Copy)]
3131
pub struct StructScalar<'a> {
3232
/// The data type of this scalar.
3333
dtype: &'a DType,

vortex-array/src/scalar/typed_view/utf8.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::scalar::ScalarValue;
2222
///
2323
/// This type provides a view into a UTF-8 string scalar value, which can be either
2424
/// a valid UTF-8 string or null.
25-
#[derive(Debug, Clone, Hash, Eq)]
25+
#[derive(Debug, Clone, Copy, Hash, Eq)]
2626
pub struct Utf8Scalar<'a> {
2727
/// The data type of this scalar.
2828
dtype: &'a DType,

0 commit comments

Comments
 (0)