Skip to content

ARROW-6043: [Python] Array equals returns incorrectly if NaNs are in arrays - #8288

Closed
kszucs wants to merge 4 commits into
apache:masterfrom
kszucs:eq-nan
Closed

kszucs wants to merge 4 commits into
apache:masterfrom
kszucs:eq-nan

Conversation

@kszucs

@kszucs kszucs commented Sep 28, 2020 •

Copy link
Copy Markdown
Member

Expose EqualOptions and set nans_equal to True. We should probably reduce Array::Equals to data structure equality and move the ArrayEquals implementation to the comparison kernels.

@github-actions

Copy link
Copy Markdown

Comment thread python/pyarrow/array.pxi Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not:

    def equals(Array self, Array other, *, nans_equal=True):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The ship might have sailed on this (I don't know how long this is already exposed in the public C++ API), but numpy has this as equal_nan keyword

@pitrou

pitrou commented Sep 29, 2020

Copy link
Copy Markdown
Member

Should other equals methods (ChunkedArray, Table, RecordBatch) be changed as well?

@jorisvandenbossche

Copy link
Copy Markdown
Member

Expose EqualOptions and set nans_equal to False.

The code actually sets it to True, not False (meaning that equals will return True if NaNs are at the same location)

But so that means we change the behaviour again? Because ARROW-6043 reported that it changed from True to False (which is the behaviour on master as well)

@kszucs

kszucs commented Oct 10, 2020

Copy link
Copy Markdown
Member Author

Well, the best would be to set EqualOptions::nans_equal_ to true by default otherwise we need to wire the equal options through all calls.

@jorisvandenbossche

Copy link
Copy Markdown
Member

@kszucs do you want to rebase/update this?

@pitrou

pitrou commented May 4, 2022

Copy link
Copy Markdown
Member

This would deserve to be revived and/or restarted. @AlenkaF @raulcd Does one of you want to take it up?

@kszucs

kszucs commented May 4, 2022

Copy link
Copy Markdown
Member Author

Due to the conflicts it would be better to restart, so I'll close this PR.

Note that wiring the default EqualOptions through the API will break the previous behaviour, so it may need a deprecation period before actually using the default settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants