Skip to content

Commit

Permalink
fix(rust): Expand i128 primitive type match (#17076)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kylea650 authored Jun 22, 2024
1 parent 3af8115 commit 46ba436
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/polars-arrow/src/array/equal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ pub fn equal(lhs: &dyn Array, rhs: &dyn Array) -> bool {
let rhs = rhs.as_any().downcast_ref().unwrap();
boolean::equal(lhs, rhs)
},
Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
let lhs = lhs.as_any().downcast_ref().unwrap();
let rhs = rhs.as_any().downcast_ref().unwrap();
primitive::equal::<$T>(lhs, rhs)
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-arrow/src/array/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fmt::{Result, Write};

use super::Array;
use crate::bitmap::Bitmap;
use crate::{match_integer_type, with_match_primitive_type};
use crate::{match_integer_type, with_match_primitive_type_full};

/// Returns a function that writes the value of the element of `array`
/// at position `index` to a [`Write`],
Expand All @@ -17,7 +17,7 @@ pub fn get_value_display<'a, F: Write + 'a>(
Boolean => Box::new(|f, index| {
super::boolean::fmt::write_value(array.as_any().downcast_ref().unwrap(), index, f)
}),
Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
let writer = super::primitive::fmt::get_write_value::<$T, _>(
array.as_any().downcast_ref().unwrap(),
);
Expand Down
6 changes: 3 additions & 3 deletions crates/polars-arrow/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ pub fn to_data(array: &dyn Array) -> arrow_data::ArrayData {
match array.data_type().to_physical_type() {
Null => to_data_dyn!(array, NullArray),
Boolean => to_data_dyn!(array, BooleanArray),
Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
to_data_dyn!(array, PrimitiveArray<$T>)
}),
Binary => to_data_dyn!(array, BinaryArray<i32>),
Expand Down Expand Up @@ -487,7 +487,7 @@ pub fn from_data(data: &arrow_data::ArrayData) -> Box<dyn Array> {
match data_type.to_physical_type() {
Null => Box::new(NullArray::from_data(data)),
Boolean => Box::new(BooleanArray::from_data(data)),
Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
Box::new(PrimitiveArray::<$T>::from_data(data))
}),
Binary => Box::new(BinaryArray::<i32>::from_data(data)),
Expand Down Expand Up @@ -786,7 +786,7 @@ pub use utf8::{MutableUtf8Array, MutableUtf8ValuesArray, Utf8Array, Utf8ValuesIt
pub use values::ValueSize;

pub(crate) use self::ffi::{offset_buffers_children_dictionary, FromFfi, ToFfi};
use crate::{match_integer_type, with_match_primitive_type, with_match_primitive_type_full};
use crate::{match_integer_type, with_match_primitive_type_full};

/// A trait describing the ability of a struct to create itself from a iterator.
/// This is similar to [`Extend`], but accepted the creation to error.
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-arrow/src/io/avro/read/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::array::*;
use crate::datatypes::*;
use crate::record_batch::RecordBatchT;
use crate::types::months_days_ns;
use crate::with_match_primitive_type;
use crate::with_match_primitive_type_full;

fn make_mutable(
data_type: &ArrowDataType,
Expand All @@ -19,7 +19,7 @@ fn make_mutable(
PhysicalType::Boolean => {
Box::new(MutableBooleanArray::with_capacity(capacity)) as Box<dyn MutableArray>
},
PhysicalType::Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
PhysicalType::Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
Box::new(MutablePrimitiveArray::<$T>::with_capacity(capacity).to(data_type.clone()))
as Box<dyn MutableArray>
}),
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-arrow/src/scalar/equal.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::sync::Arc;

use super::*;
use crate::{match_integer_type, with_match_primitive_type};
use crate::{match_integer_type, with_match_primitive_type_full};

impl PartialEq for dyn Scalar + '_ {
fn eq(&self, that: &dyn Scalar) -> bool {
Expand Down Expand Up @@ -38,7 +38,7 @@ fn equal(lhs: &dyn Scalar, rhs: &dyn Scalar) -> bool {
match lhs.data_type().to_physical_type() {
Null => dyn_eq!(NullScalar, lhs, rhs),
Boolean => dyn_eq!(BooleanScalar, lhs, rhs),
Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
dyn_eq!(PrimitiveScalar<$T>, lhs, rhs)
}),
LargeUtf8 => dyn_eq!(Utf8Scalar<i64>, lhs, rhs),
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-arrow/src/scalar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod union;

pub use union::UnionScalar;

use crate::{match_integer_type, with_match_primitive_type};
use crate::{match_integer_type, with_match_primitive_type_full};

/// Trait object declaring an optional value with a [`ArrowDataType`].
/// This strait is often used in APIs that accept multiple scalar types.
Expand Down Expand Up @@ -119,7 +119,7 @@ pub fn new_scalar(array: &dyn Array, index: usize) -> Box<dyn Scalar> {
};
Box::new(BooleanScalar::new(value))
},
Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
let array = array
.as_any()
.downcast_ref::<PrimitiveArray<$T>>()
Expand Down

0 comments on commit 46ba436

Please sign in to comment.