Skip to content

fix: plumb SchemaProvider table_type through FFI#22694

Open
chakkk309 wants to merge 1 commit into
apache:mainfrom
chakkk309:fix-ffi-schema-provider-table-type
Open

fix: plumb SchemaProvider table_type through FFI#22694
chakkk309 wants to merge 1 commit into
apache:mainfrom
chakkk309:fix-ffi-schema-provider-table-type

Conversation

@chakkk309
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #22333.

Rationale for this change

FFI_SchemaProvider did not expose SchemaProvider::table_type, so foreign consumers fell back to table() just to read table types. This PR plumbs table_type through the FFI schema provider and keeps local-bypass behavior intact.

What changes are included in this PR?

  • Add a table_type FFI callback to FFI_SchemaProvider.
  • Implement ForeignSchemaProvider::table_type via the new callback.
  • Add unit tests for forced-foreign and local-bypass paths.
  • Add ffi_catalog integration coverage for override and fallback table_type behavior.

Are these changes tested?

  • cargo fmt --all --check
  • cargo test -p datafusion-ffi
  • cargo test -p datafusion-ffi --features integration-tests --test ffi_catalog
  • cargo clippy -p datafusion-ffi --all-targets --features integration-tests -- -D warnings

@github-actions github-actions Bot added the ffi Changes to the ffi crate label Jun 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

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 v53.1.0 (current)
       Built [  65.593s] (current)
     Parsing datafusion-ffi v53.1.0 (current)
      Parsed [   0.063s] (current)
    Building datafusion-ffi v53.1.0 (baseline)
       Built [  58.868s] (baseline)
     Parsing datafusion-ffi v53.1.0 (baseline)
      Parsed [   0.074s] (baseline)
    Checking datafusion-ffi v53.1.0 -> v53.1.0 (no change; assume patch)
     Checked [   0.318s] 222 checks: 220 pass, 1 fail, 1 warn, 30 skip

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field FFI_SchemaProvider.table_type in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:55

--- warning repr_c_plain_struct_fields_reordered: struct fields reordered in repr(C) struct ---

Description:
A public repr(C) struct had its fields reordered. This can change the struct's memory layout, possibly breaking FFI use cases that depend on field position and order.
        ref: https://doc.rust-lang.org/reference/type-layout.html#reprc-structs
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/repr_c_plain_struct_fields_reordered.ron

Failed in:
  FFI_SchemaProvider.register_table moved from position 4 to 5, in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:61
  FFI_SchemaProvider.deregister_table moved from position 5 to 6, in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:68
  FFI_SchemaProvider.table_exist moved from position 6 to 7, in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:74
  FFI_SchemaProvider.logical_codec moved from position 7 to 8, in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:76
  FFI_SchemaProvider.clone moved from position 8 to 9, in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:80
  FFI_SchemaProvider.release moved from position 9 to 10, in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:83
  FFI_SchemaProvider.version moved from position 10 to 11, in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:86
  FFI_SchemaProvider.private_data moved from position 11 to 12, in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:90
  FFI_SchemaProvider.library_marker_id moved from position 12 to 13, in /home/runner/work/datafusion/datafusion/datafusion/ffi/src/schema_provider.rs:95

     Summary semver requires new major version: 1 major and 0 minor checks failed
     Warning produced 1 major and 0 minor level warnings
    Finished [ 126.990s] datafusion-ffi

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

Labels

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.

FFI: FFI_SchemaProvider missing table_type cheap-path

1 participant