-
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
Implement Table.replace for the database backend #8986
Conversation
t . should_equal table | ||
Problems.expect_warning Empty_Error t | ||
|
||
group_builder.specify "asdfasdfshould throw an error on an empty (but well-formed) lookup table and non-empty base table if allow_unmatched_rows=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.
group_builder.specify "asdfasdfshould throw an error on an empty (but well-formed) lookup table and non-empty base table if allow_unmatched_rows=False" <| | |
group_builder.specify "should throw an error on an empty (but well-formed) lookup table and non-empty base table if allow_unmatched_rows=False" <| |
Typo?
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.
Done
not, and allow_unmatched_rows=False, throw | ||
`Unmatched_Rows_In_Lookup` with the first row of the | ||
table. Otherwise, attach a warning. | ||
if base_table.row_count == 0 || allow_unmatched_rows then Warning.attach (Empty_Error.Error lookup_table) base_table 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.
if base_table.row_count == 0 || allow_unmatched_rows then Warning.attach (Empty_Error.Error lookup_table) base_table else | |
if base_table.row_count == 0 || allow_unmatched_rows then Warning.attach (Empty_Error.Error "lookup_table") base_table else |
Without the quotes the message will contain the contents of the map. Which being empty won't be so informative for the user.
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.
Done
respectively. | ||
lookup_table_renamed = selected_lookup_columns . rename_columns (Map.from_vector [[from_column_resolved, duplicate_key_column_name], [to_column_resolved, column]]) | ||
|
||
warn_if_empty result_table = if lookup_table_renamed.row_count != 0 then result_table else Warning.attach (Empty_Error.Error lookup_table_renamed) result_table |
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.
warn_if_empty result_table = if lookup_table_renamed.row_count != 0 then result_table else Warning.attach (Empty_Error.Error lookup_table_renamed) result_table | |
warn_if_empty result_table = if lookup_table_renamed.row_count != 0 then result_table else Warning.attach (Empty_Error.Error "lookup_table") result_table |
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.
Done
lookup_table = table_builder_typed [['x', []], ['z', []]] Value_Type.Integer | ||
t = table.replace lookup_table 'x' . order_by ['y'] | ||
t . should_equal table | ||
Problems.expect_warning Empty_Error t |
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.
Problems.expect_warning Empty_Error t | |
Problems.expect_warning (Empty_Error "lookup_table") t | |
If you go with my above change. But either way I think our tests should be more specific when testing errors.
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.
Done
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.
Think we need to change the Empty_Error arguments
@from_column Widget_Helpers.make_column_name_selector | ||
@to_column Widget_Helpers.make_column_name_selector |
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.
aren't these from the lookup_table
so the selector is wrong?
We need to have widgets derived from first argument for this I think.
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'm not sure what the notation would be for this -- is there documentation for the @ clauses? Or, where is it implemented? I don't see an example of a widget attached to a value other than self
.
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.
Removed.
|
||
## PRIVATE | ||
The largest dataset that can be used to make a literal table, expressed in number of elements. | ||
MAX_LITERAL_ELEMENT_COUNT = 256 |
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.
256 a reasonable literal default. Agee with @radeusgd should be a temp table when gets bigger!
Also implements
Table.replace
using aMap
.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.