Skip to content

Fix np.where logic in table.join - #9313

Merged
mhvk merged 5 commits into
astropy:masterfrom
bsipocz:table_fix_join_mask
Oct 4, 2019
Merged

mhvk merged 5 commits into
astropy:masterfrom
bsipocz:table_fix_join_mask

Conversation

@bsipocz

@bsipocz bsipocz commented Oct 4, 2019

Copy link
Copy Markdown
Member

This regression was unearthed while doing #9287, and thus be opened as a separate PR to be able to backport the fix.

@bsipocz bsipocz added this to the v2.0.15 milestone Oct 4, 2019
@astropy-bot astropy-bot Bot added the table label Oct 4, 2019
@bsipocz bsipocz added the Bug label Oct 4, 2019
@bsipocz
bsipocz requested review from astrofrog and taldcroft October 4, 2019 06:15
Comment thread astropy/table/operations.py Outdated
non_right_mask = ~right_mask
if np.any(right_mask):
out[out_name][right_mask] = right[right_name].take(right_out)
out[out_name] = left[left_name].take(left_out)

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 this change? And should this not be an in-place change at least? (with [:])

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

indeed, it should use [:]. As for the rest of the changes, I did the fix to follow the very same logic as the np.where above (the issue with that it doesn't understand Quantities for np <1.17 and astropy <4.0):

                out[out_name][:] = np.where(right_mask,
                                            left[left_name].take(left_out),
                                            right[right_name].take(right_out))

@bsipocz
bsipocz force-pushed the table_fix_join_mask branch from ffb02e8 to 58b235b Compare October 4, 2019 15:56
@bsipocz

bsipocz commented Oct 4, 2019 •

Copy link
Copy Markdown
Member Author

(a rebase has solved the weird appveyor issue, so if we don't see it popping up elsewhere we are good)

@bsipocz
bsipocz requested a review from astrofrog October 4, 2019 17:37

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good with @astrofrog's comment addressed, so approving.

@mhvk
mhvk merged commit d280767 into astropy:master Oct 4, 2019
bsipocz pushed a commit that referenced this pull request Oct 5, 2019
bsipocz pushed a commit that referenced this pull request Oct 5, 2019
bsipocz pushed a commit that referenced this pull request Oct 7, 2019
bsipocz pushed a commit that referenced this pull request Oct 7, 2019
@bsipocz
bsipocz deleted the table_fix_join_mask branch September 16, 2024 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants