Skip to content

FFI: FFI_GroupsAccumulator missing size #22335

@timsaucer

Description

@timsaucer

Gap

FFI_GroupsAccumulator in datafusion/ffi/src/udaf/groups_accumulator.rs does not plumb GroupsAccumulator::size. The consumer side cannot ask the producer how much memory the accumulator currently holds.

Missing method

  • size

Why it matters

Severity: minor. Memory accounting on the consumer side (spill / memory-pool tracking) reports whatever the trait default returns rather than the producer's real footprint. Wrong answers may cause unnecessary spills or, worse, OOMs that go uncaught by the pool.

Implementation notes

  • Plumb as unsafe extern \"C\" fn(this: &Self) -> usize; wrapper body calls inner.size().
  • Layout change → api change label, target main only, no back-port to branch-<major>.
  • Add a unit test (forced-foreign via mock_foreign_marker_id) asserting the consumer-side size() matches the producer's response. Integration test under datafusion/ffi/tests/ if the producer side is exercised cross-library.

Generated from an audit performed for PR #22327 (datafusion-ffi agent skill). If a PR addressing this finds the omission to be a false positive, please also propose an update to the datafusion-ffi skill so future audits do not re-flag it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestffiChanges to the ffi cratefunctionsChanges to functions implementation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions