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

Add support for Blank_Columns to Table and Database #3812

Merged
merged 12 commits into from
Oct 20, 2022

Conversation

radeusgd
Copy link
Member

@radeusgd radeusgd commented Oct 19, 2022

Pull Request Description

Implements https://www.pivotaltracker.com/story/show/183390281 and https://www.pivotaltracker.com/story/show/183390394

Important Notes

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 ide build and ./run ide watch.

@radeusgd radeusgd changed the title Add the new selector and tests for it Add support for Blank_Columns to Database.Table Oct 19, 2022
Comment on lines +457 to +464
## UNSTABLE
Replaces `True` values with `when_true` and `False` with `when_false`.
Only meant for use with boolean columns.

TODO: Currently `when_true` and `when_false` need to be a single value.
In the future the API will also support row-based IIF if they are columns.
iif : Any -> Any -> Column
iif self when_true when_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.

I decided to just implement a prototype, because full iif relies on Value Type works that is not completed yet. It correctly implements a subset of the true iif that is enough for our current internal use-case. I then plan to revisit it when we will be actually implementing the column operations, having already the type logic in place.

@radeusgd radeusgd self-assigned this Oct 19, 2022
@radeusgd radeusgd marked this pull request as ready for review October 19, 2022 11:58
column_names = columns.map .name
new_selector = Column_Selector.By_Name column_names Text_Matcher.Case_Sensitive
self.select_columns_helper new_selector reorder=reorder problem_builder=problem_builder
Column_Selector.Blank_Columns when_any treat_nans_as_blank -> if self.internal_columns.is_empty then [] else
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 is the relevant part, the rest of this file is mostly moving functions around - I moved common functions relying on select_columns_helper to the Table_Column_Helper so that we can create the helper type in one place in each table, encapsulating any changes to the common logic that is required for selecting columns (now we needed to add additional callbacks to make it possible to select blank columns, it may change again in the future so I want to amend only Table.columns_helper instead of all Table_Helpers invocations within Table).

@jdunkerley
Copy link
Member

Looks great - nice to use our own APIs more to answer it.

@radeusgd radeusgd added the CI: Ready to merge This PR is eligible for automatic merge label Oct 20, 2022
@radeusgd radeusgd changed the title Add support for Blank_Columns to Database.Table Add support for Blank_Columns to Table and Database Oct 20, 2022
@mergify mergify bot merged commit cc76e7d into develop Oct 20, 2022
@mergify mergify bot deleted the wip/radeusgd/select-blank-columns-183390281 branch October 20, 2022 09:11
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.

2 participants