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

Add replace operator #897

Merged
merged 2 commits into from
Oct 27, 2022
Merged

Add replace operator #897

merged 2 commits into from
Oct 27, 2022

Conversation

ChrisJar
Copy link
Collaborator

Closes #895

Copy link
Collaborator

@ayushdg ayushdg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes generally look good. Minor suggestions

Comment on lines 545 to 548
if isinstance(s, str):
return s.replace(pat, repl)
elif isinstance(s, dd.Series):
return s.str.replace(pat, repl)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion: Can replace the is instance checks with something similar to this

if is_frame(s):
s = s.str

Comment on lines +526 to +527
REPLACE(a, 'r', 'l') as w,
REPLACE('Another String', 'th', 'b') as x
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add some tests to the unit/test_call::test_string_operations unit tests. Preferable with some edge cases if possible

@codecov-commenter
Copy link

Codecov Report

Merging #897 (4207be0) into main (2dfa5f7) will increase coverage by 0.17%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #897      +/-   ##
==========================================
+ Coverage   75.20%   75.38%   +0.17%     
==========================================
  Files          72       72              
  Lines        3779     3786       +7     
  Branches      674      675       +1     
==========================================
+ Hits         2842     2854      +12     
+ Misses        804      795       -9     
- Partials      133      137       +4     
Impacted Files Coverage Δ
dask_sql/physical/rex/core/call.py 81.33% <100.00%> (+0.29%) ⬆️
dask_sql/_version.py 35.31% <0.00%> (+1.41%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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.

[ENH] Support SQL "replace" function
3 participants