-
Notifications
You must be signed in to change notification settings - Fork 326
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 Columns_To_Add type to move away from Integer | Nothing #10152
Conversation
|
||
## PRIVATE | ||
type Columns_To_Add | ||
## Read all rows. |
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 doc comment seems off.
distribution/lib/Standard/Table/0.0.0-dev/src/Columns_To_Add.enso
Outdated
Show resolved
Hide resolved
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.
Looks good, just some small nits
Co-authored-by: Radosław Waśko <[email protected]>
_ = [column, delimiter, column_count, on_problems] | ||
@column_count Columns_To_Add.default_widget | ||
split_to_columns : Text | Integer -> Text -> Columns_To_Add -> Problem_Behavior -> DB_Table | ||
split_to_columns self column delimiter="," (column_count : Columns_To_Add = ..All_Columns) on_problems=Report_Warning = |
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.
Please update the Arguments: documentation above for column_count
, here, and in the other related spots.
@@ -22,11 +23,11 @@ polyglot java import org.enso.table.data.mask.OrderMask | |||
- input_column: The column to transform. | |||
- function: A function that transforms a single element of `input_column` | |||
to multiple values. | |||
fan_out_to_columns : Table -> Text | Integer -> (Any -> Vector Any) -> Integer | Nothing -> (Integer -> Any) -> Problem_Behavior -> Table | Nothing | |||
fan_out_to_columns table input_column_id function column_count=Nothing column_builder=make_string_builder on_problems=Report_Error = | |||
fan_out_to_columns : Table -> Text | Integer -> (Any -> Vector Any) -> Columns_To_Add -> (Integer -> Any) -> Problem_Behavior -> Table | Nothing |
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.
Please add argument documentation for column_count
.
Co-authored-by: Radosław Waśko <[email protected]>
@@ -204,7 +205,7 @@ add_specs suite_builder = | |||
t = Table.new cols | |||
expected_rows = [[0, "a", "c", Nothing, Nothing], [1, "c", "d", "ef", Nothing], [2, "gh", "ij", "u", Nothing]] | |||
expected = Table.from_rows ["foo", "bar 1", "bar 2", "bar 3", "bar 3"] expected_rows | |||
t2 = t.split_to_columns "bar" "b" column_count=4 | |||
t2 = t.split_to_columns "bar" "b" column_count=(Columns_To_Add.First 4) |
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.
Will the old behaviour still work? I think that it should and we should leave the test in place to ensure that it does
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.
Old behaviour will still work as we have conversion from Integer to Columns_To_Add.
We should keep a test proving this.
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.
Looks good. I just have a question of whether this should be a breaking API change for existing workflows?
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.
A few little tweaks but looks good.
@@ -39,6 +39,7 @@ import Standard.Table.Internal.Widget_Helpers | |||
import Standard.Table.Match_Columns as Match_Columns_Helpers | |||
import Standard.Table.Row.Row | |||
import Standard.Table.Rows_To_Read.Rows_To_Read | |||
import Standard.Table.Columns_To_Add.Columns_To_Add |
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.
small nit but please put in alphabetical order
distribution/lib/Standard/Table/0.0.0-dev/src/Columns_To_Add.enso
Outdated
Show resolved
Hide resolved
@@ -7,6 +7,7 @@ import project.Conversions.Convertible_To_Rows.Key_Value | |||
import project.Internal.Problem_Builder.Problem_Builder | |||
import project.Table.Table | |||
import project.Value_Type.Value_Type | |||
import project.Columns_To_Add.Columns_To_Add |
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.
as above please sort alphabetically.
distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Split_Tokenize.enso
Outdated
Show resolved
Hide resolved
Don't believe we have a breaking API change. Happy path is unchanged, though unhappy path now a warning not an error but think this is ok. |
My question is can you pass Nothing and an Integer into this parameter as you could before? And should you be able to? |
Yes you can (as the auto conversion will be fired). This is the same as when I change |
Co-authored-by: James Dunkerley <[email protected]>
Co-authored-by: James Dunkerley <[email protected]>
…okenize.enso Co-authored-by: James Dunkerley <[email protected]>
Pull Request Description
Adds new type "Coulmns_To_Add" that replaces the Integer | Nothing type

And adds new widget to split_to_columns and tokenise_to_columns
Closes #10041
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.