Skip to content

[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
drexler-sky:docstring2
Closed

[SPARK-50703][PYTHON] Refine the docstring of regexp_replace, regexp_substr, and regexp_instr#49348
drexler-sky wants to merge 2 commits intoapache:masterfrom
drexler-sky:docstring2

Conversation

@drexler-sky
Copy link
Contributor

What changes were proposed in this pull request?

Refined docstring for regexp_replace, regexp_substr, and regexp_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

[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()
Copy link
Member

Choose a reason for hiding this comment

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

can we write some explanation for individual examples?

@HyukjinKwon
Copy link
Member

cc @zhengruifeng

regexp : :class:`~pyspark.sql.Column` or column name
regex pattern to apply.
idx : int, optional
idx : :class:`~pyspark.sql.Column` or int, optional
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

It is used via RegExpExtractBase :-)

@zhengruifeng
Copy link
Contributor

thanks, merged to master

@drexler-sky
Copy link
Contributor Author

Thanks @HyukjinKwon @zhengruifeng

@drexler-sky drexler-sky deleted the docstring2 branch January 6, 2025 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments