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

Refactor table.group_by to table.aggregate #3339

Merged
merged 5 commits into from
Mar 15, 2022
Merged

Conversation

jdunkerley
Copy link
Member

@jdunkerley jdunkerley commented Mar 14, 2022

Pull Request Description

Following UX work move to table.aggregate function.

Checklist

Please include the following checklist in your PR:

  • The documentation has been updated if necessary.
  • All code conforms to the Scala, Java, and Rust style guides.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed: Enso GUI was tested when built using BOTH ./run dist and ./run watch.

Copy link
Member

@radeusgd radeusgd 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.

I really like how the unit tests already show how this new design seems to be more versatile and readable, even though I still find it a bit peculiar :)

Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

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

Oh I missed something important.

The unit tests are missing any examples when the grouping happens over keys of more than one field. I think this should be checked - at least for 2-3 fields in the grouping. Also would be good to have at least some tests where the key fields are not first on the list - I know looking at the implementation this probably won't break - but good to check such a case since it is allowed and supported - at least to catch any future regressions and act as documentation of intent.

Comment on lines 528 to 502
add_row key =
add_row _ =
Copy link
Member

Choose a reason for hiding this comment

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

If the key argument is unused, maybe worth just making it take Nothing?
Well, technically even, just making it:

add_row =
    ... the code ...

...

row_index = map.get_or_else key add_row

should work because this will be a no-argument function.

@jdunkerley jdunkerley added the CI: Ready to merge This PR is eligible for automatic merge label Mar 15, 2022
@mwu-tow mwu-tow merged commit 6c1c455 into develop Mar 15, 2022
@mwu-tow mwu-tow deleted the wip/jd/table.aggregate branch March 15, 2022 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants