[SPARK-50703][PYTHON] Refine the docstring of regexp_replace, regexp_substr, and regexp_instr#49348
Closed
drexler-sky wants to merge 2 commits intoapache:masterfrom
Closed
[SPARK-50703][PYTHON] Refine the docstring of regexp_replace, regexp_substr, and regexp_instr#49348drexler-sky wants to merge 2 commits intoapache:masterfrom
drexler-sky wants to merge 2 commits intoapache:masterfrom
Conversation
…substr, and regexp_instr
HyukjinKwon
reviewed
Jan 3, 2025
| [Row(d='-----')] | ||
| >>> df.select(regexp_replace("str", col("pattern"), col("replacement")).alias('d')).collect() | ||
| [Row(d='-----')] | ||
| >>> df.select('*', sf.regexp_replace('str', r'(\d+)', '--')).show() |
Member
There was a problem hiding this comment.
can we write some explanation for individual examples?
Member
drexler-sky
commented
Jan 4, 2025
| regexp : :class:`~pyspark.sql.Column` or column name | ||
| regex pattern to apply. | ||
| idx : int, optional | ||
| idx : :class:`~pyspark.sql.Column` or int, optional |
Contributor
Author
There was a problem hiding this comment.
idx doesn't seem to be used in the Scala code https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala#L1153. Should we remove this parameter for now?
Member
There was a problem hiding this comment.
It is used via RegExpExtractBase :-)
zhengruifeng
approved these changes
Jan 6, 2025
Contributor
|
thanks, merged to master |
Contributor
Author
|
Thanks @HyukjinKwon @zhengruifeng |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Refined docstring for
regexp_replace,regexp_substr, andregexp_instr.Why are the changes needed?
to improve docs and test coverage
Does this PR introduce any user-facing change?
doc-only changes
How was this patch tested?
doctests
Was this patch authored or co-authored using generative AI tooling?
No