Skip to content

fix: preserve scalar UDF strictness across FFI - #25109

Open
emecii wants to merge 1 commit into
apache:mainfrom
emecii:fix/ffi-scalar-udf-is-strict
Open

fix: preserve scalar UDF strictness across FFI#25109
emecii wants to merge 1 commit into
apache:mainfrom
emecii:fix/ffi-scalar-udf-is-strict

Conversation

@emecii

@emecii emecii commented Sep 9, 2026

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

Foreign scalar UDFs currently lose their is_strict() value across the FFI boundary. The consumer therefore reports false, preventing optimizer rules from using the provider's nullability metadata.

What changes are included in this PR?

  • Add an is_strict callback to FFI_ScalarUDF.
  • Forward the provider's value through ForeignScalarUDF.
  • Test forced-foreign and dynamic-library round trips.

What is the testing strategy for this PR?

  • cargo test -p datafusion-ffi --features integration-tests
  • cargo fmt --all -- --check

The FFI test suite passes with 122 unit tests plus the integration targets.

Are there any user-facing changes?

Yes. Foreign scalar UDFs now preserve strictness metadata. The FFI_ScalarUDF layout changes, so this PR requires the api change label.

Forward ScalarUDFImpl::is_strict through FFI_ScalarUDF and cover both forced-foreign and cross-library round trips.

Generated-by: Codex (GPT-5)
@github-actions github-actions Bot added the ffi Changes to the ffi crate label Sep 9, 2026
@emecii

emecii commented Sep 9, 2026

Copy link
Copy Markdown
Author

@timsaucer, could you please add the required api change label and trigger CI when convenient?

AI-generated with Codex (GPT-5).

@timsaucer timsaucer added the api change Changes the API exposed to users of the crate label Sep 9, 2026
@timsaucer

Copy link
Copy Markdown
Member

This looks very straight forward. Can you clean up the PR description, though? There's a bit of slop in it.

@emecii

emecii commented Sep 9, 2026

Copy link
Copy Markdown
Author

Cleaned up the description and removed the local environment details. Thanks.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.80%. Comparing base (4048898) to head (54f894e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25109      +/-   ##
==========================================
- Coverage   81.80%   81.80%   -0.01%     
==========================================
  Files        1130     1130              
  Lines      417754   417765      +11     
  Branches   417754   417765      +11     
==========================================
  Hits       341754   341754              
- Misses      55875    55881       +6     
- Partials    20125    20130       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

Thank you for opening this pull request!

Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).

Details
     Cloning apache/main
    Building datafusion-ffi v55.0.0 (current)
       Built [  63.252s] (current)
     Parsing datafusion-ffi v55.0.0 (current)
      Parsed [   0.062s] (current)
    Building datafusion-ffi v55.0.0 (baseline)
       Built [  55.548s] (baseline)
     Parsing datafusion-ffi v55.0.0 (baseline)
      Parsed [   0.063s] (baseline)
    Checking datafusion-ffi v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.244s] 223 checks: 222 pass, 1 fail, 0 warn, 31 skip

--- failure constructible_struct_adds_field: struct exhaustively constructible through public API adds field ---

Description:
A pub struct that could be exhaustively constructed with a literal using only public API has a new pub field, breaking existing exhaustive literals.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field FFI_ScalarUDF.is_strict in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/udf/mod.rs:135

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [ 120.656s] datafusion-ffi

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change Changes the API exposed to users of the crate auto detected api change Auto detected API change ffi Changes to the ffi crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants