-
Notifications
You must be signed in to change notification settings - Fork 323
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
Add support for Blank_Columns
to Table and Database
#3812
Conversation
TODO: not implemented yet
Blank_Columns
to Database.Table
## 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 = |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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).
Looks great - nice to use our own APIs more to answer it. |
Blank_Columns
to Database.TableBlank_Columns
to Table and Database
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:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.