Skip to content

Conversation

@wetneb
Copy link
Member

@wetneb wetneb commented Mar 26, 2025

This implements the two criteria defined in #5576 concerning the behaviour of the operation when:

  • only reordering columns, without deleting any
  • only deleting columns, keeping the order of the remaining ones

Those changes can be made without changing the dialog's UI. Making the operation analyzable in general would likely require a different UI to let the user better specify their intent.

I am not sure if it should close the issue, maybe it's good enough, maybe not.

This implements the two criteria defined in OpenRefine#5576 concerning the
behaviour of the operation when:
* only reordering columns, without deleting any
* only deleting columns, keeping the order of the remaining ones

Those changes can be made without changing the dialog's UI. Making
the operation analyzable in general would likely require a different UI
to let the user better specify their intent.
Copy link
Member

@SoryRawyer SoryRawyer left a comment

Choose a reason for hiding this comment

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

@wetneb apologies for the delay reviewing this! Just to confirm, this is somewhat of a breaking change in that columns will no longer be removed in every case. Is that right? I know that's what the user feedback gathered by @magdmartin states, but if and when this is released I want to make sure to point this out in the release notes.

Also, it looks like there are reorder-columns commands in other frontend components as well: menu-edit-column.js and data-table-view.js also have reorder commands in them. Should those be updated as well (even if only to avoid having a null value for isPureReorder)?

ColumnReorderOperation op = ParsingUtilities.mapper.readValue("{\"op\":\"core/column-reorder\","
+ "\"columnNames\":[\"b\",\"c\",\"a\"]}", ColumnReorderOperation.class);
assertEquals(op._columnNames, List.of("b", "c", "a"));
assertEquals(op._isPureReorder, false);
Copy link
Member Author

Choose a reason for hiding this comment

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

@SoryRawyer The test above shows the backwards-compatibility for this change. The old serialization format of this operation (without the isPureReorder field) will still be understood as before, as an operation that removes any columns that are not mentioned in the columnNames list.

This means that if users execute recipes generated from a previous version of OpenRefine with the new version, they should still get the same results.

@wetneb
Copy link
Member Author

wetneb commented May 14, 2025

Also, it looks like there are reorder-columns commands in other frontend components as well: menu-edit-column.js and data-table-view.js also have reorder commands in them. Should those be updated as well (even if only to avoid having a null value for isPureReorder)?

That's a very good point! The column reordering operation that is used to implement the "join" action is one that is used to remove columns only, without doing any reordering. Thanks to the backwards-compatibility mentioned above, it doesn't need a isPureReorder field to continue working (but we could also add one for clarity if you want). In any case, I wanted to migrate this to use the column-multi-removal operation, as it would make it generalize better. Should I do this in this PR too?

@SoryRawyer
Copy link
Member

Thanks to the backwards-compatibility mentioned above, it doesn't need a isPureReorder field to continue working (but we could also add one for clarity if you want). In any case, I wanted to migrate this to use the column-multi-removal operation, as it would make it generalize better. Should I do this in this PR too?

Thanks for the context! I don't think that's necessary to include in this PR.

I think this looks good! I'm going to approve but wait a day or two to merge in case anyone has a last-minute comment.

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.

2 participants