Skip to content

Conversation

@sfc-gh-aherreraaguilar
Copy link
Collaborator

@sfc-gh-aherreraaguilar sfc-gh-aherreraaguilar commented Oct 23, 2025

  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-2443512

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
    • If adding any arguments to public Snowpark APIs or creating new public Snowpark APIs, I acknowledge that I have ensured my changes include AST support. Follow the link for more information: AST Support Guidelines
  3. Please describe how your code solves the related issue.

Add support for the scalar string and binary functions:

  • hex_decode_string
  • jarowinkler_similarity
  • parse_url
  • regexp_instr
  • regexp_like
  • regexp_substr
  • regexp_substr_all
  • rtrimmed_length
  • space
  • split_part

@sfc-gh-aherreraaguilar sfc-gh-aherreraaguilar changed the title SNOW-2443512: Add support for scalar string and binary functions SNOW-2443512: Add support for scalar string and binary functions ( part 2 ) Oct 23, 2025
Copy link

@sfc-gh-mvegaalvarez sfc-gh-mvegaalvarez left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines +4164 to +4171
if position is None:
position = lit(1)
if occurrence is None:
occurrence = lit(1)
if option is None:
option = lit(0)
if regexp_parameters is None:
regexp_parameters = lit("c")
Copy link
Contributor

Choose a reason for hiding this comment

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

I have two questions here:

  1. do we need to check the dependency between the optional args? what happen if occurrence is set but position is not set. I feel this is not allowed in sql as in sql the arguments are positional, users have to specify position first then occurrence then possibly the rest.

  2. I see there is a long note about
    Note By default, REGEXP_INSTR returns the begin or end character offset for the entire matching part of the subject. However, if the e (for “extract”) parameter is specified, REGEXP_INSTR returns the begin or end character offset for the part of the subject that matches the first sub-expression in the pattern. If e is specified but a group_num is not also specified, then the group_num defaults to 1 (the first group). If there is no sub-expression in the pattern, REGEXP_INSTR behaves as if e was not set. For examples that use e, see [Examples](https://docs.snowflake.com/en/sql-reference/functions/regexp_instr#examples) in this topic.

shall we not set the default value from client at all and let server decide the default rule? I feel this way it's simpler

Comment on lines +4239 to +4245
subject: ColumnOrName,
pattern: ColumnOrName,
position: ColumnOrName = None,
occurrence: ColumnOrName = None,
regex_parameters: ColumnOrName = None,
group_num: ColumnOrName = None,
_emit_ast: bool = True,
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as above



@publicapi
def regexp_substr_all(
Copy link
Contributor

Choose a reason for hiding this comment

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

same for this func

…yPart2

# Conflicts:
#	CHANGELOG.md
#	docs/source/snowpark/functions.rst
#	src/snowflake/snowpark/_functions/scalar_functions.py
…yPart2

# Conflicts:
#	CHANGELOG.md
#	src/snowflake/snowpark/_functions/scalar_functions.py
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.

4 participants