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

SNOW-683625: Standardize RLIKE (REGEXP/RLIKE in Snowflake) and add CONTAINS method to Column #571

Closed
ChuliangXiao opened this issue Oct 25, 2022 · 2 comments
Labels
feature New feature or request

Comments

@ChuliangXiao
Copy link
Contributor

This is more of Snowflake syntax issue.

What is the current behavior?

To match any string containing ABC, .rlike('.*ABC.*')
Also Snowflake CONTAINS is not available for Snowpark Column yet.

What is the desired behavior?

To match any string containing ABC, .rlike('ABC')

How would this improve snowflake-snowpark-python?

Make RLIKE consistent with other SQL, i.e. pySpark and MySQL

References, Other Background

According to Snowflake Docs on REGEXP,

The function implicitly anchors a pattern at both ends (i.e. '' automatically becomes '^$', and 'ABC' automatically becomes '^ABC$'). To match any string starting with ABC, the pattern would be 'ABC.*'.

@ChuliangXiao ChuliangXiao added the feature New feature or request label Oct 25, 2022
@github-actions github-actions bot changed the title Standardize RLIKE (REGEXP/RLIKE in Snowflake) and add CONTAINS method to Column SNOW-683625: Standardize RLIKE (REGEXP/RLIKE in Snowflake) and add CONTAINS method to Column Oct 25, 2022
@sfc-gh-jdu
Copy link
Collaborator

Hi @ChuliangXiao, REGEXP in Snowflake has been there for a while and our Python API should align with Snowflake SQL, so we might not want to change it. But we can add contains to Column class, which will satisfy your need described in this issue, right? For now, you can use contains function first as a workaround.

@ChuliangXiao
Copy link
Contributor Author

Hi @ChuliangXiao, REGEXP in Snowflake has been there for a while and our Python API should align with Snowflake SQL, so we might not want to change it. But we can add contains to Column class, which will satisfy your need described in this issue, right? For now, you can use contains function first as a workaround.

Thanks for suggesting the contains function. Would be great to have contains in the Column class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants