Add missing conditional functions#1464
Merged
timsaucer merged 6 commits intoapache:mainfrom Apr 3, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Exposes missing conditional scalar functions in datafusion-python to close #1449, adding Python wrappers/bindings and unit tests.
Changes:
- Add Python API functions:
greatest,least,nvl2, andifnull(alias fornvl). - Add Rust PyO3 bindings for
greatest,least(variadic) andnvl2. - Add unit tests covering numeric/string behavior and null handling.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| python/datafusion/functions.py | Adds new public Python wrappers and updates exports (__all__). |
| crates/core/src/functions.rs | Exposes the corresponding DataFusion functions to Python via PyO3 wrappers. |
| python/tests/test_functions.py | Adds unit tests validating the new functions’ behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nuno-faria
approved these changes
Apr 3, 2026
Contributor
nuno-faria
left a comment
There was a problem hiding this comment.
Thanks @timsaucer. I think df in the new tests can be removed as suggested by copilot.
…che#1449) Expose four conditional functions from upstream DataFusion that were not yet available in the Python bindings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests cover multiple data types (integers, strings), null handling (all-null, partial-null), multiple arguments, and ifnull/nvl equivalence. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace separate test functions for coalesce, greatest, least, nvl, nvl2, ifnull with a single parametrized test using a shared fixture. Adds coverage for nvl, nullif (previously untested), datetime and boolean types, literal fallbacks, and variadic calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c773349 to
835f91f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #1449
Rationale for this change
There are a few methods missing from the Python library, so this exposes them.
What changes are included in this PR?
Exposes python functions.
Adds unit tests.
Are there any user-facing changes?
Addition only.