-
Notifications
You must be signed in to change notification settings - Fork 117
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
SNOW-1480718: Support Series.str.translate #1776
Conversation
src/snowflake/snowpark/modin/plugin/compiler/snowflake_query_compiler.py
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.
some minor comments
src/snowflake/snowpark/modin/plugin/compiler/snowflake_query_compiler.py
Show resolved
Hide resolved
src/snowflake/snowpark/modin/plugin/compiler/snowflake_query_compiler.py
Outdated
Show resolved
Hide resolved
src/snowflake/snowpark/modin/plugin/compiler/snowflake_query_compiler.py
Outdated
Show resolved
Hide resolved
39b0624
to
0c4dd8d
Compare
0c4dd8d
to
9d4421b
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.
LGTM. Thanks, Jonathan! Can you please update the PR description to better describe the plan for supporting multi-characters in the future? You can give a short description and point to the slack thread for more details.
30257dc
to
b2cc413
Compare
b2cc413
to
98eeec7
Compare
src/snowflake/snowpark/modin/plugin/compiler/snowflake_query_compiler.py
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.
nice work!
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-1480718
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
This PR implements Series.str.translate using SQL TRANSLATE.
Unlike the native pandas version, we cannot perform one-to-many character mappings with SQL TRANSLATE. I considered using chained
REPLACE
calls to mimic this behavior, but that would cause discrepancies in situations where one REPLACE mapping generates entries that match the replacement keys of a subsequent REPLACE calls. As such, for these use cases it is recommended for users to manually chainSeries.str.replace
calls as necessary.Slack thread discussing future work on a more robust multi-character approach using REPLACE with sentinel values: https://snowflake.slack.com/archives/C04HF38JFAQ/p1718388095381469