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

Use checked signatures for Table and Column #12283

Merged
merged 33 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e6fa9ca
comparisons
radeusgd Feb 13, 2025
c7fb171
operations 1
radeusgd Feb 13, 2025
72589e8
operations 2
radeusgd Feb 13, 2025
071dd34
table
radeusgd Feb 13, 2025
98153cb
typos
radeusgd Feb 13, 2025
d13726c
adapt signatures
radeusgd Feb 13, 2025
75c3973
update tests
radeusgd Feb 13, 2025
6c92253
more removing old sigs
radeusgd Feb 14, 2025
fae28bd
update test
radeusgd Feb 14, 2025
2d40143
Revert "update test"
radeusgd Feb 14, 2025
2fff82a
update test v2
radeusgd Feb 14, 2025
0e5366b
temporarily avoid type error on text contains etc.
radeusgd Feb 14, 2025
8fb40a8
update DB_Column using linter
radeusgd Feb 14, 2025
c5f7083
add element types to checked Vector/Dictionary sigs
radeusgd Feb 14, 2025
f067f64
more aligning
radeusgd Feb 14, 2025
7b35eb9
align DB_Table
radeusgd Feb 17, 2025
709a72f
fix typo
radeusgd Feb 17, 2025
943943c
rewrite Table using new rules
radeusgd Feb 17, 2025
b13fc5e
fix whitespace in DB_Table
radeusgd Feb 17, 2025
5adec91
fix whitespace in DB_Column
radeusgd Feb 17, 2025
0745ba2
fix indentation in doc comment
radeusgd Feb 17, 2025
927b913
apply formatting to Column
radeusgd Feb 17, 2025
ecc1e66
fmt
radeusgd Feb 17, 2025
e42effc
trying to fix signatures
radeusgd Feb 17, 2025
9cfd48f
for now make types of Column text ops less strict - inner checks hand…
radeusgd Feb 17, 2025
2d03daf
Array needed to be accepted in is_in make expressions work
radeusgd Feb 17, 2025
f13080d
update type signature that was very obsolete, also update obsolete co…
radeusgd Feb 17, 2025
409e81e
write can return other types than File (e.g. Enso_File, S3_File etc.)
radeusgd Feb 17, 2025
00e9384
Merge branch 'develop' into wip/radeusgd/check-table-column-methods
radeusgd Feb 18, 2025
bfd82f1
fix double ! signatures
radeusgd Feb 18, 2025
547bd23
CR fix missing !
radeusgd Feb 18, 2025
89a963f
CR fix Column instead of DB_Column
radeusgd Feb 18, 2025
fbc2966
CR a bit more precise type for get_row
radeusgd Feb 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1153,8 +1153,8 @@ type Decimal

Decimal.parse "(123,456,789.654)" format="###,###.##;(###,###.##)"
# => -123456789.654
parse : Text -> Locale -> Text -> Decimal ! Number_Parse_Error ! Illegal_Argument
parse text:Text locale:Locale=Locale.default format:Text="" -> Decimal ! Number_Parse_Error ! Illegal_Argument =
parse : Text -> Locale -> Text -> Decimal ! Number_Parse_Error | Illegal_Argument
parse text:Text locale:Locale=Locale.default format:Text="" -> Decimal ! Number_Parse_Error | Illegal_Argument =
Illegal_Argument.handle_java_exception <|
# `getInstance` returns `DecimalFormat` or a subclass of `DecimalFormat`.
decimal_format = NumberFormat.getInstance locale.java_locale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,8 @@ type Float

Float.parse "(123,456,789.654)" format="###,###.##;(###,###.##)"
# => -123456789.654
parse : Text -> Locale | Nothing -> Text | Nothing -> Float ! Number_Parse_Error ! Illegal_Argument
parse text:Text (locale : Locale | Nothing = Nothing) (format : Text | Nothing = Nothing) -> Float ! Number_Parse_Error ! Illegal_Argument =
parse : Text -> Locale | Nothing -> Text | Nothing -> Float ! Number_Parse_Error | Illegal_Argument
parse text:Text (locale : Locale | Nothing = Nothing) (format : Text | Nothing = Nothing) -> Float ! Number_Parse_Error | Illegal_Argument =
case locale.is_nothing && format.is_nothing of
True ->
Panic.catch NumberFormatException (Double.parseDouble text) _->
Expand Down
238 changes: 80 additions & 158 deletions distribution/lib/Standard/Database/0.0.0-dev/src/DB_Column.enso

Large diffs are not rendered by default.

212 changes: 74 additions & 138 deletions distribution/lib/Standard/Database/0.0.0-dev/src/DB_Table.enso

Large diffs are not rendered by default.

282 changes: 97 additions & 185 deletions distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso

Large diffs are not rendered by default.

232 changes: 81 additions & 151 deletions distribution/lib/Standard/Table/0.0.0-dev/src/Table.enso

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1317,10 +1317,10 @@ add_column_operation_specs suite_builder setup =
group_builder.specify "text_left and text_right should error on non integer parameters" <|
t = table_builder [["numbers", [1, 2, 3]]]
col = t.at "numbers"
col.text_left 3.14 . should_fail_with Invalid_Value_Type
col.text_right 3.14 . should_fail_with Invalid_Value_Type
col.text_left "7" . should_fail_with Invalid_Value_Type
col.text_left "7" . should_fail_with Invalid_Value_Type
Test.expect_panic Type_Error <| col.text_left 3.14
Test.expect_panic Type_Error <| col.text_right 3.14
Test.expect_panic Type_Error <| col.text_left "7"
Test.expect_panic Type_Error <| col.text_left "7"

group_builder.specify "text_left and text_right should return empty on zero argument" <|
with_mixed_columns_if_supported [["strings", ["a", "foobar", "", Nothing, "👩‍🔬👩‍🔬V👩‍🔬👩‍🔬", "café", "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of light, it was the season of darkness, it was the spring of hope, it was the winter of despair."]]] t->
Expand Down Expand Up @@ -1647,7 +1647,7 @@ add_column_operation_specs suite_builder setup =
data.c.text_replace "a" "#" . should_fail_with Invalid_Value_Type
Test.expect_panic Type_Error (data.a.text_replace 1 "#")
data.a.text_replace data.c "#" . should_fail_with Invalid_Value_Type
data.a.text_replace "a" 1 . should_fail_with Invalid_Value_Type
Test.expect_panic Type_Error (data.a.text_replace "a" 1)
data.a.text_replace "a" data.c . should_fail_with Invalid_Value_Type

group_builder.specify "should not replace if Empty term" <|
Expand Down Expand Up @@ -1695,7 +1695,7 @@ add_column_operation_specs suite_builder setup =

group_builder.specify "should only allow trim on Text columns" <|
data.c.trim what="a" . should_fail_with Invalid_Value_Type
data.a.trim what=1 . should_fail_with Invalid_Value_Type
Test.expect_panic Type_Error <| data.a.trim what=1
data.a.trim what=data.c . should_fail_with Invalid_Value_Type

suite_builder.group prefix+"(Column_Operations_Spec) Other Column Operations" group_builder->
Expand Down Expand Up @@ -1783,7 +1783,7 @@ add_column_operation_specs suite_builder setup =
t = table_builder [["a", [1, 2, 3]]]
c = t.at "a"

c.rename Nothing . should_fail_with Invalid_Column_Names
Test.expect_panic Type_Error <| c.rename Nothing
c.rename '' . should_fail_with Invalid_Column_Names
c.rename 'a\0b' . should_fail_with Invalid_Column_Names
c.rename '\0' . should_fail_with Invalid_Column_Names
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from Standard.Base import all
import Standard.Base.Errors.Common.Type_Error
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument

from Standard.Table import Table, Value_Type
Expand Down Expand Up @@ -494,7 +495,7 @@ add_specs suite_builder setup =

group_builder.specify "should check shift_amount type in date_add" <|
t = dates1.get
t.at "d_X" . date_add "text" Date_Period.Day . should_fail_with Invalid_Value_Type
Test.expect_panic Type_Error <| t.at "d_X" . date_add "text" Date_Period.Day

group_builder.specify "date_diff and date_add should work correctly with DST" pending="May be failing on some Database configurations. ToDo: investigate - https://github.com/enso-org/enso/issues/7326" <|
# TODO the behaviour here may differ between backends.
Expand Down
Loading