Skip to content

docs: document regular expression function arguments - #1684

Open
stantheman0128 wants to merge 1 commit into
apache:mainfrom
stantheman0128:docs/1463-regexp-args
Open

docs: document regular expression function arguments#1684
stantheman0128 wants to merge 1 commit into
apache:mainfrom
stantheman0128:docs/1463-regexp-args

Conversation

@stantheman0128

Copy link
Copy Markdown

Which issue does this PR close?

Related to #1463.

Rationale for this change

regexp_instr documents every parameter it takes in an Args: section. The four
other regexp_* functions document none. Someone reading the generated API docs to
find out what flags accepts, or where start counts from, gets an answer for one
function in the family and nothing for the rest.

This is the same kind of small focused pass as #1527, applied to the regular
expression family.

What changes are included in this PR?

Adds an Args: section to four functions in python/datafusion/functions/__init__.py:

  • regexp_like
  • regexp_match
  • regexp_replace
  • regexp_count

Where a parameter also exists on regexp_instr (regex, start, flags), the
wording follows what regexp_instr already says, so the family reads consistently.
The flags entry on regexp_replace also records the g behavior that the prose
above it and its own example already show.

Nothing else in the file changes. Signatures, type hints, runtime code, and existing
examples are untouched.

Are there any user-facing changes?

Yes, documentation only. The generated API docs now list argument descriptions for
these four functions. Runtime behavior is unchanged.

Validation

Pre-commit, scoped to the changed file:

$ pre-commit run --files python/datafusion/functions/__init__.py
Lint GitHub Actions workflow files...................(no files to check)Skipped
ruff (legacy alias)......................................................Passed
ruff format..............................................................Passed
Rust fmt.............................................(no files to check)Skipped
Rust clippy..........................................(no files to check)Skipped
codespell................................................................Passed
uv-lock..............................................(no files to check)Skipped

Ruff on its own, pinned to the version in .pre-commit-config.yaml:

$ ruff@0.15.1 check --config pyproject.toml python/datafusion/functions/__init__.py
All checks passed!
$ ruff@0.15.1 format --check --config pyproject.toml python/datafusion/functions/__init__.py
1 file already formatted

The repository enables --doctest-modules over python/datafusion, so the examples
in these docstrings run as tests. Against a locally built extension:

$ pytest python/datafusion/functions/__init__.py -q -k regexp
5 passed, 231 deselected, 2 warnings in 2.39s

$ pytest python/datafusion/functions/__init__.py -q
236 passed, 2 warnings in 2.06s

Whitespace:

$ git diff --check

LLM-generated code disclosure

These docstring additions were prepared with the assistance of Claude and reviewed
against each function signature before submission.

regexp_instr documents its parameters in an Args section, the other four
regexp functions document none. Adds Args to regexp_like, regexp_match,
regexp_replace and regexp_count, reusing the wording regexp_instr
already uses for the parameters they share.
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.

1 participant