Skip to content

Add missing string function contains#1465

Open
timsaucer wants to merge 2 commits intoapache:mainfrom
timsaucer:feat/add-missing-string-functions
Open

Add missing string function contains#1465
timsaucer wants to merge 2 commits intoapache: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.

timsaucer and 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.

Closes apache#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 Copilot March 30, 2026 16:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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.

File Description
crates/core/src/functions.rs Adds the contains binding via expr_fn! and registers it in init_module.
python/datafusion/functions.py Exposes contains in the public Python API and exports it via __all__.
python/tests/test_functions.py Adds an assertion verifying contains produces the expected boolean array results.

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

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.

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

2 participants