Skip to content

Add support for sorting table with non-mutable columns#9549

Merged
taldcroft merged 4 commits intoastropy:masterfrom
taldcroft:table-sort-non-mutable
Nov 7, 2019
Merged

Add support for sorting table with non-mutable columns#9549
taldcroft merged 4 commits intoastropy:masterfrom
taldcroft:table-sort-non-mutable

Conversation

@taldcroft
Copy link
Member

@taldcroft taldcroft commented Nov 6, 2019

Fixes #9536

EDIT: Close #9537

@taldcroft taldcroft added the table label Nov 6, 2019
@taldcroft taldcroft added this to the v4.0 milestone Nov 6, 2019
@taldcroft taldcroft requested a review from mhvk November 6, 2019 18:18
try:
col[:] = new_col
except Exception:
self[col.info.name] = new_col
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried setting to the new column in all cases but this caused problems with indexes which would require a deeper dive to understand / fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK - I think here having a solution is definitely much better than worry about perfection. Maybe a new issue, though?

Copy link
Member

@hamogu hamogu left a comment

Choose a reason for hiding this comment

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

Looks good to me, but I leave formal approval to a table maintainer.

new_col = col.take(indexes, axis=0)
try:
col[:] = new_col
except Exception:
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 make it to the specific exception?

Suggested change
except Exception:
except TypeError:

Copy link
Member Author

Choose a reason for hiding this comment

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

This exception can be raised by arbitrary user-defined mixin columns, so I have no idea what exception class they might raise in this case.

@bsipocz
Copy link
Member

bsipocz commented Nov 6, 2019

Looks good, one tiny comment on the exception

Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

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

This is great! I have one request for a more elaborate comment, but it is not essential, so approving.

try:
col[:] = new_col
except Exception:
self[col.info.name] = new_col
Copy link
Contributor

Choose a reason for hiding this comment

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

OK - I think here having a solution is definitely much better than worry about perfection. Maybe a new issue, though?

@taldcroft taldcroft force-pushed the table-sort-non-mutable branch from b6394b9 to 084d434 Compare November 6, 2019 23:04
@taldcroft
Copy link
Member Author

I think I have addressed review comments.

@bsipocz - we need to do something, anything about the changelog conflict mess. 😈 I just got hit with a conflict again.

@taldcroft
Copy link
Member Author

Maybe a new issue, though?

#9553

@taldcroft taldcroft merged commit 6f31b28 into astropy:master Nov 7, 2019
@taldcroft taldcroft deleted the table-sort-non-mutable branch November 7, 2019 10:13
@bsipocz
Copy link
Member

bsipocz commented Nov 7, 2019

we need to do something, anything about the changelog conflict mess.

This is really unfortunate, I agree. I'll try to play a bit with the rebase github action, it may just address the biggest painpoints we have.

(But just as with the json approach, one doesn't need to insert the new entry at the very bottom of the section 🤷‍♀ )

@hamogu
Copy link
Member

hamogu commented Nov 7, 2019

I thought new entries where supposed to be ordered by PR number. If that's not the case, things do get easier...

@bsipocz
Copy link
Member

bsipocz commented Nov 7, 2019

No, there are no rules on ordering. Traditionally they are ordered by the order of merging, but that's that the same as the PR number, and the conflicts are coming from the fact that one usually adds the new entry at the bottom of a section and git is very careful to not auto-merge these, but flag them as conflict. The rebase bot should easily handle it.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table with mixin column with SkyCoords can't be sorted

4 participants