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

Allow expressions in filter columns #97

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

rbayet
Copy link
Contributor

@rbayet rbayet commented Feb 8, 2024

PR Checklist

Please check if your pull request fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A
The current behavior: the table filters are constructed which before this PR only allow a scalar, i.e. actual column value (as first argument).
This does not allow to build a condition where the subject/column is actually an expression.

What is the new behavior?

As for the filter value, allows using the syntax 'expr: [My SQL expression]' as a filter column, for instance

my_table:
    filters:
       - ["expr: COALESCE(foo, '')", 'notLike', '%bar%']

if you wish to exclude the rows of my_table where the foo column contains 'bar' but also keep the rows where foo is null.

Does this PR introduce a breaking change?

[ ] Yes
[X] No

Other information

Due to the way the filters interpretation is done, I was not able to add a specific unit test.

@rbayet rbayet force-pushed the feat_allow_expr_in_filter_columns branch from 745b178 to 88f9813 Compare February 8, 2024 11:36
@guvra guvra merged commit b9d3ca9 into Smile-SA:main Feb 8, 2024
2 checks passed
@rbayet rbayet deleted the feat_allow_expr_in_filter_columns branch February 8, 2024 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants