-
Notifications
You must be signed in to change notification settings - Fork 321
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
New set function, parse a column #4097
Conversation
6621ad1
to
1ad5f13
Compare
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.
Approval of table visualization file.
engine/runtime/src/main/java/org/enso/interpreter/runtime/data/text/Text.java
Show resolved
Hide resolved
21b91f8
to
22aa2e3
Compare
## PRIVATE | ||
Gets a widget set up for a Filter_Condition. | ||
widget_for_filter_condition = | ||
## values = ["(Filter_Condition.Equal to=_)", "(Filter_Condition.Not_Equal to=_)", "(Filter_Condition.Is_In values=_)", "(Filter_Condition.Not_In values=_)", "Filter_Condition.Is_True", "Filter_Condition.Is_False", "Filter_Condition.Is_Nothing", "Filter_Condition.Not_Nothing", "Filter_Condition.Is_Empty", "Filter_Condition.Not_Empty", "(Filter_Condition.Less than=_)", "(Filter_Condition.Equal_Or_Less than=_)", "(Filter_Condition.Greater than=_)", "(Filter_Condition.Equal_Or_Greater than=_)", "(Filter_Condition.Between lower=_ upper=_)", "(Filter_Condition.Starts_With prefix=_)", "(Filter_Condition.Ends_With suffix=_)", "(Filter_Condition.Contains substring=_)", "(Filter_Condition.Not_Contains substring=_)", "(Filter_Condition.Like pattern=_)", "(Filter_Condition.Not_Like pattern=_)"] |
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.
Is this commented out value still needed?
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.
Preferred this form but it caused IDE issues so stuck with the simpler form.
Kept for now in case want it as widgets develop.
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso
Outdated
Show resolved
Hide resolved
## PRIVATE | ||
Gets a widget set up for a Filter_Condition. | ||
widget_for_filter_condition = | ||
## values = ["(Filter_Condition.Equal to=_)", "(Filter_Condition.Not_Equal to=_)", "(Filter_Condition.Is_In values=_)", "(Filter_Condition.Not_In values=_)", "Filter_Condition.Is_True", "Filter_Condition.Is_False", "Filter_Condition.Is_Nothing", "Filter_Condition.Not_Nothing", "Filter_Condition.Is_Empty", "Filter_Condition.Not_Empty", "(Filter_Condition.Less than=_)", "(Filter_Condition.Equal_Or_Less than=_)", "(Filter_Condition.Greater than=_)", "(Filter_Condition.Equal_Or_Greater than=_)", "(Filter_Condition.Between lower=_ upper=_)", "(Filter_Condition.Starts_With prefix=_)", "(Filter_Condition.Ends_With suffix=_)", "(Filter_Condition.Contains substring=_)", "(Filter_Condition.Not_Contains substring=_)", "(Filter_Condition.Like pattern=_)", "(Filter_Condition.Not_Like pattern=_)"] |
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.
What is the purpose of the commented out line? If we want to include it, I'd suggest explaining what this alternative code means.
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.
Kept for now as an alternative experiment. I don't expect either of these lines to be here for much longer once we get to proper structure being passed.
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Column.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Database/0.0.0-dev/src/Connection/Postgres_Options.enso
Show resolved
Hide resolved
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Column.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso
Outdated
Show resolved
Hide resolved
@@ -242,7 +242,7 @@ agg_count_distinct_include_null args = | |||
|
|||
## PRIVATE |
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 was surprised to learn that while Postgres has starts_with
, there's no ends_with
😮
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.
Yep, stoopid.
text = [starts_with, contains, ends_with, fold_case, make_case_sensitive]+concat_ops | ||
text = [starts_with, contains, ends_with, make_case_sensitive]+concat_ops |
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.
Why is it removed?
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.
Using the dialect was causing other issues with making the behaviour between the 3 (SQLite, Postgres, InMemory) act consistently. Not using and relying on the LOWER(UPPER(...))
produced consistent results.
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.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.
Awesome changes! 🎉
I'm really glad on how the new Table.set
is looking, I think it's a good direction. Column.parse
and Table.compute
are also very cool.
Just some comments in line, I think it would be great to add a few tests.
new_column = Expression.evaluate expression get_column make_constant "Standard.Table.Data.Column" "Column" Column.var_args_functions | ||
if new_column.is_error then new_column else | ||
warnings = Warning.get_all new_column | ||
rename = new_column.rename expression |
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 see that here we are not 'sanitizing' the column name. Shall we try to make the generated column names consistent? Maybe let's sanitize them on both sides then? Ideally using a shared function, probably from a shared module like Table_Helpers
.
I remember we had some task to do at some point to ensure that names of columns generated by operations on columns (like +
etc.) should be consistent between the two backends (currently they are not); so ideally these new operations should not introduce new inconsistencies.
t2.at "floats" . to_vector . should_equal c2 | ||
t2.at "bools" . to_vector . should_equal c3 | ||
|
||
Test.group "Column.parse" <| |
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 think I don't see any tests for column.parse Auto
. Shall we add one?
2cc81a4
to
80ec6c0
Compare
Make postgres default DB be postgres.
Adjust SQLite to use GLOB for starts_with and ends_with to make it case sensitive by default.
DB implementation is still old but API matches.
80ec6c0
to
2baad65
Compare
Pull Request Description
set
function design - takes aColumn
and works with that more easily and supports control ofSet_Mode
.parse
API onColumn
.filter
to newfilter_by_expression
onTable
.compute
function allowing creation of a column from an expression.Column
based onstarts_with
,ends_with
andcontains
.Filter_Condition
forStarts_With
,Ends_With
,Contains
andNot_Contains
..pretty
that wasn't escaping\
.postgres
.Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.