diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Split_Tokenize.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Split_Tokenize.enso index 1d32ebd85910..e08b9b6c6627 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Split_Tokenize.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Split_Tokenize.enso @@ -65,7 +65,7 @@ parse_to_columns table input_column_id pattern="." case_sensitivity=Case_Sensiti column = table.at input_column_id new_table = Value_Type.expect_text column <| - fan_out_to_rows_and_columns table input_column_id fun column_names on_problems=on_problems + fan_out_to_rows_and_columns table input_column_id fun column_names at_least_one_row=True on_problems=on_problems if parse_values then new_table.parse on_problems=on_problems else new_table ## PRIVATE diff --git a/test/Table_Tests/src/In_Memory/Split_Tokenize_Spec.enso b/test/Table_Tests/src/In_Memory/Split_Tokenize_Spec.enso index f9cd354c65e5..f4e32c4ce8db 100644 --- a/test/Table_Tests/src/In_Memory/Split_Tokenize_Spec.enso +++ b/test/Table_Tests/src/In_Memory/Split_Tokenize_Spec.enso @@ -306,20 +306,25 @@ spec = actual.should_equal expected Test.specify "input with no matches" <| - t = Table.from_rows ["foo", "bar", "baz"] [["x", "a", "y"]] - expected = Table.from_rows ["foo", "bar", "baz"] [] + t = Table.from_rows ["foo", "bar", "baz"] [["x", "a", "y"], ["xx", "q12", "yy"], ["xxx", "34r", "yyyy"]] + expected = Table.from_rows ["foo", "bar", "baz"] [["x", Nothing, "y"], ["xx", 12, "yy"], ["xxx", 34, "yyyy"]] actual = t.parse_to_columns "bar" "\d+" actual.should_equal expected + t2 = Table.new [["amount", ["$1.23B", "$1.3M", "$2.32M $3.43B", "None"]]] + expected2 = Table.from_rows ["Raised", "Scale"] [[1.23, "B"], [1.3, "M"], [2.32, "M"], [3.43, "B"], [Nothing, Nothing]] + actual2 = t2.parse_to_columns "amount" "\$(?\d+(?:.\d+)?)(?B|M)" + actual2.should_equal expected2 + Test.specify "input with no matches, with regex groups" <| t = Table.from_rows ["foo", "bar", "baz"] [["x", "a", "y"]] - expected = Table.from_rows ["foo", "bar 1", "bar 2", "baz"] [] + expected = Table.from_rows ["foo", "bar 1", "bar 2", "baz"] [["x", Nothing, Nothing, "y"]] actual = t.parse_to_columns "bar" "(\d)(\d)" actual.should_equal expected Test.specify "input with no matches, with named and unnamed regex groups" <| t = Table.from_rows ["foo", "bar", "baz"] [["x", "a", "y"]] - expected = Table.from_rows ["foo", "quux", "bar 1", "foo 1", "bar 2", "baz"] [] + expected = Table.from_rows ["foo", "quux", "bar 1", "foo 1", "bar 2", "baz"] [["x", Nothing, Nothing, Nothing, Nothing, "y"]] actual = t.parse_to_columns "bar" "(?)(\d)(?\d)(\d)" actual.should_equal expected