Add docstring examples for Scalar string functions#1423
Add docstring examples for Scalar string functions#1423ntjohnson1 wants to merge 1 commit intoapache:mainfrom
Conversation
Add example usage to docstrings for Scalar string functions to improve documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
kosiew
left a comment
There was a problem hiding this comment.
@ntjohnson1
Thanks for your contribution
| 'HELLO' | ||
| """ | ||
| return Expr(f.upper(arg.expr)) | ||
|
|
There was a problem hiding this comment.
The PR title is Add docstring examples for Scalar string functions but
several public scalar string helpers still have no examples. The most visible gaps are concat, concat_ws, and the regex helpers (regexp_like, regexp_match, regexp_replace, regexp_count, regexp_instr). Because those are part of the same public surface area this patch is trying to document, I think this is still incomplete.
| @@ -754,6 +845,15 @@ def instr(string: Expr, substring: Expr) -> Expr: | |||
| """Finds the position from where the ``substring`` matches the ``string``. | |||
|
|
|||
| This is an alias for :py:func:`strpos`. | |||
There was a problem hiding this comment.
instr and position are aliases for strpos, but all three now carry near-identical worked examples.
I’d recommend keeping the full example on strpos and making the alias docs point to it, so future edits only need to update one example.
Which issue does this PR close?
Rationale for this change
Add example usage to docstrings for Scalar string functions to improve documentation.
What changes are included in this PR?
The first PR was basically adding a docstring to everything in functions. I broke it apart into a PR (that already merged) for the infra. I then reviewed and merged an example PR of adding the docstrings in parts. This is now the follow up opening a handful of PRs for the remaining functions in functions.py Everything is co-authored with Claude since I used claude to extend the handwritten examples I wrote for reference and to split apart the large PR rather than doing it manually.
I've reviewed all the code prior to PR.
Are there any user-facing changes?
No