Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arro3-core/python/arro3/core/_buffer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ else:

class Buffer(_Buffer):
"""An Arrow Buffer"""
def __eq__(self, value: object) -> bool: ...
def __init__(self, buffer) -> None: ...
def __buffer__(self, flags: int) -> memoryview: ...
def __len__(self) -> int: ...
Expand Down
3 changes: 2 additions & 1 deletion pyo3-arrow/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ use crate::PyArray;
/// The Python buffer protocol is implemented on this buffer to enable zero-copy data transfer of
/// the core buffer into Python. This allows for zero-copy data sharing with numpy via
/// `numpy.frombuffer`.
#[pyclass(module = "arro3.core._core", name = "Buffer", subclass, frozen)]
#[derive(PartialEq)]
#[pyclass(module = "arro3.core._core", name = "Buffer", subclass, frozen, eq)]
pub struct PyArrowBuffer(Buffer);

impl AsRef<Buffer> for PyArrowBuffer {
Expand Down
14 changes: 8 additions & 6 deletions pyo3-arrow/src/chunked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ use crate::{PyArray, PyDataType, PyField, PyScalar};
/// A Python-facing Arrow chunked array.
///
/// This is a wrapper around a [FieldRef] and a `Vec` of [ArrayRef].
#[derive(Debug)]
#[pyclass(module = "arro3.core._core", name = "ChunkedArray", subclass, frozen)]
#[derive(Debug, PartialEq)]
#[pyclass(
module = "arro3.core._core",
name = "ChunkedArray",
subclass,
frozen,
eq
)]
pub struct PyChunkedArray {
chunks: Vec<ArrayRef>,
field: FieldRef,
Expand Down Expand Up @@ -353,10 +359,6 @@ impl PyChunkedArray {
)
}

fn __eq__(&self, other: &PyChunkedArray) -> bool {
self.field == other.field && self.chunks == other.chunks
}

fn __getitem__(&self, i: isize) -> PyArrowResult<PyScalar> {
// Handle negative indexes from the end
let mut i = if i < 0 {
Expand Down
6 changes: 1 addition & 5 deletions pyo3-arrow/src/datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<'a> FromPyObject<'_, 'a> for PyTimeUnit {

/// A Python-facing wrapper around [DataType].
#[derive(PartialEq, Eq, Debug)]
#[pyclass(module = "arro3.core._core", name = "DataType", subclass, frozen)]
#[pyclass(module = "arro3.core._core", name = "DataType", subclass, frozen, eq)]
pub struct PyDataType(DataType);

impl PyDataType {
Expand Down Expand Up @@ -135,10 +135,6 @@ impl PyDataType {
to_schema_pycapsule(py, &self.0)
}

fn __eq__(&self, other: PyDataType) -> bool {
self.equals(other, false)
}

fn __hash__(&self) -> u64 {
let mut hasher = DefaultHasher::new();
self.0.hash(&mut hasher);
Expand Down
8 changes: 2 additions & 6 deletions pyo3-arrow/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use crate::PyDataType;
/// A Python-facing Arrow field.
///
/// This is a wrapper around a [FieldRef].
#[derive(Debug)]
#[pyclass(module = "arro3.core._core", name = "Field", subclass, frozen)]
#[derive(Debug, PartialEq)]
#[pyclass(module = "arro3.core._core", name = "Field", subclass, frozen, eq)]
pub struct PyField(FieldRef);

impl PyField {
Expand Down Expand Up @@ -129,10 +129,6 @@ impl PyField {
to_schema_pycapsule(py, self.0.as_ref())
}

fn __eq__(&self, other: &PyField) -> bool {
self.0 == other.0
}

fn __repr__(&self) -> String {
self.to_string()
}
Expand Down
14 changes: 8 additions & 6 deletions pyo3-arrow/src/record_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ use crate::{PyArray, PyField, PySchema};
/// A Python-facing Arrow record batch.
///
/// This is a wrapper around a [RecordBatch].
#[pyclass(module = "arro3.core._core", name = "RecordBatch", subclass, frozen)]
#[derive(Debug)]
#[pyclass(
module = "arro3.core._core",
name = "RecordBatch",
subclass,
frozen,
eq
)]
#[derive(Debug, PartialEq)]
pub struct PyRecordBatch(RecordBatch);

impl PyRecordBatch {
Expand Down Expand Up @@ -196,10 +202,6 @@ impl PyRecordBatch {
to_schema_pycapsule(py, self.0.schema_ref().as_ref())
}

fn __eq__(&self, other: &PyRecordBatch) -> bool {
self.0 == other.0
}

fn __getitem__(&self, key: FieldIndexInput) -> PyResult<Arro3Array> {
self.column(key)
}
Expand Down
8 changes: 2 additions & 6 deletions pyo3-arrow/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use crate::{PyDataType, PyField, PyTable};
/// A Python-facing Arrow schema.
///
/// This is a wrapper around a [SchemaRef].
#[derive(Debug)]
#[pyclass(module = "arro3.core._core", name = "Schema", subclass, frozen)]
#[derive(Debug, PartialEq)]
#[pyclass(module = "arro3.core._core", name = "Schema", subclass, frozen, eq)]
pub struct PySchema(SchemaRef);

impl PySchema {
Expand Down Expand Up @@ -140,10 +140,6 @@ impl PySchema {
to_schema_pycapsule(py, self.0.as_ref())
}

fn __eq__(&self, other: &PySchema) -> bool {
self.0 == other.0
}

fn __getitem__(&self, key: FieldIndexInput) -> PyArrowResult<Arro3Field> {
self.field(key)
}
Expand Down
8 changes: 2 additions & 6 deletions pyo3-arrow/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ use crate::{PyChunkedArray, PyField, PyRecordBatch, PyRecordBatchReader, PySchem
/// A Python-facing Arrow table.
///
/// This is a wrapper around a [SchemaRef] and a `Vec` of [RecordBatch].
#[pyclass(module = "arro3.core._core", name = "Table", subclass, frozen)]
#[derive(Debug)]
#[pyclass(module = "arro3.core._core", name = "Table", subclass, frozen, eq)]
#[derive(Debug, PartialEq)]
pub struct PyTable {
batches: Vec<RecordBatch>,
schema: SchemaRef,
Expand Down Expand Up @@ -273,10 +273,6 @@ impl PyTable {
)
}

fn __eq__(&self, other: &PyTable) -> bool {
self.batches == other.batches && self.schema == other.schema
}

fn __getitem__(&self, key: FieldIndexInput) -> PyArrowResult<Arro3ChunkedArray> {
self.column(key)
}
Expand Down