Skip to content

Add missing conditional functions - #1464

Merged
timsaucer merged 6 commits into
apache:mainfrom
timsaucer:add-missing-conditional-functions
Apr 3, 2026
Merged

Add missing conditional functions#1464
timsaucer merged 6 commits into
apache:mainfrom
timsaucer:add-missing-conditional-functions

Conversation

@timsaucer

Copy link
Copy Markdown
Member

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.

@timsaucer
timsaucer marked this pull request as ready for review March 30, 2026 11:14
@timsaucer
timsaucer requested a review from CopilotMarch 30, 2026 16:22

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

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, and ifnull (alias for nvl).
  • Add Rust PyO3 bindings for greatest, least (variadic) and nvl2.
  • 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.

FileDescription
python/datafusion/functions.pyAdds new public Python wrappers and updates exports (__all__).
crates/core/src/functions.rsExposes the corresponding DataFusion functions to Python via PyO3 wrappers.
python/tests/test_functions.pyAdds unit tests validating the new functions’ behavior.

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

Comment threadpython/tests/test_functions.py Outdated
Comment threadpython/tests/test_functions.py Outdated
Comment threadpython/tests/test_functions.py Outdated
Comment threadpython/tests/test_functions.py Outdated

@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. I think df in the new tests can be removed as suggested by copilot.

timsaucerand others added 5 commits April 3, 2026 13:10
…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>
@timsaucer
timsaucerforce-pushed the add-missing-conditional-functions branch from c773349 to 835f91fCompareApril 3, 2026 17:49
@timsaucer
timsaucer merged commit 0b6ea95 into apache:mainApr 3, 2026
21 checks passed
@timsaucer
timsaucer deleted the add-missing-conditional-functions branch April 3, 2026 19:43
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 conditional functions (greatest, least, nvl2, ifnull)

3 participants

@timsaucer@nuno-faria