Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-43985: [Python][C++] Fixed pyarrow table equality function not comparing table data when comparing against itself #44497

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
3 changes: 0 additions & 3 deletions cpp/src/arrow/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,6 @@ Result<std::shared_ptr<Table>> PromoteTableToSchema(const std::shared_ptr<Table>
}

bool Table::Equals(const Table& other, bool check_metadata) const {
if (this == &other) {
return true;
}
if (!schema_->Equals(*other.schema(), check_metadata)) {
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions python/pyarrow/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2301,6 +2301,10 @@ def test_table_from_pydict(cls):
with pytest.raises(TypeError):
cls.from_pydict({'a': [1, 2, 3]}, schema={})

# With dicts containing NaNs
table = cls.from_pydict({"foo": [float("nan")]})
assert table != table
Comment on lines +2304 to +2306
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a C++ level test to detect this case only in C++ level?



@pytest.mark.parametrize('data, klass', [
((['', 'foo', 'bar'], [4.5, 5, None]), pa.array),
Expand Down
Loading