Skip to content

Add missing string function contains - #1465

Merged
timsaucer merged 3 commits into
apache:mainfrom
timsaucer:feat/add-missing-string-functions
Apr 3, 2026
Merged

Add missing string function contains#1465
timsaucer merged 3 commits into
apache:mainfrom
timsaucer:feat/add-missing-string-functions

Conversation

@timsaucer

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes#1450

Rationale for this change

This function was not exposed, but exists upstream.

What changes are included in this PR?

Expose function on rust and python APIs.
Add unit test.

Are there any user-facing changes?

Addition only.

timsaucerand others added 2 commits March 30, 2026 07:30
Expose the upstream DataFusion `contains(string, search_str)` function
which returns true if search_str is found within string (case-sensitive).
Note: the other functions from apache#1450 (instr, position, substring_index)
already exist — instr and position are aliases for strpos, and
substring_index is exposed as substr_index.
Closesapache#1450
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@timsaucer
timsaucer marked this pull request as ready for review March 30, 2026 16:21
@timsaucer
timsaucer requested a review from CopilotMarch 30, 2026 16:21

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR closes #1450 by exposing DataFusion’s upstream contains string scalar function through both the Rust (PyO3) bindings and the public Python datafusion.functions API, with a corresponding unit test to validate behavior.

Changes:

  • Added a PyO3 wrapper for contains in the Rust core bindings and registered it in the Python module init.
  • Exposed contains in python/datafusion/functions.py (including __all__) with a user-facing docstring.
  • Added a unit test case covering functions.contains on string input.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
crates/core/src/functions.rsAdds the contains binding via expr_fn! and registers it in init_module.
python/datafusion/functions.pyExposes contains in the public Python API and exports it via __all__.
python/tests/test_functions.pyAdds an assertion verifying contains produces the expected boolean array results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nuno-farianuno-faria left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @timsaucer.

Comment threadpython/datafusion/functions.py Outdated
Co-authored-by: Nuno Faria <nunofpfaria@gmail.com>
@timsaucer
timsaucer merged commit 645d261 into apache:mainApr 3, 2026
7 checks passed
@timsaucer
timsaucer deleted the feat/add-missing-string-functions branch April 3, 2026 17:51
Sign up for freeto 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.

Add missing string functions (contains, instr, position, substring_index)

3 participants

@timsaucer@nuno-faria