Skip to content

Conversation

@polywj
Copy link

@polywj polywj commented Feb 5, 2026

Description

This PR refactors lancedb_record_batch_reader_from_arrow to return a LanceDBError code and an optional error message, aligning it with other fallible APIs in the library. Previously, this function returned NULL on failure, providing no context on why the Arrow import failed (e.g., schema validation errors vs. array import errors). This closes #7.

Changes

  • API Breaking Change: lancedb_record_batch_reader_from_arrow now returns LanceDBError instead of a pointer.
    • Added output parameter LanceDBRecordBatchReader** reader_out.
    • Added output parameter char** error_message.
  • Implementation: Updated Rust FFI implementation in src/table.rs to catch and report errors during Schema and RecordBatch import from the Arrow C ABI using handle_error.
  • Documentation: Updated include/lancedb.h and docs/index.rst to reflect the new signature and memory management rules (caller must free the error message if provided).
  • Examples & Tests: Updated examples/full.cpp, examples/simple.cpp, and tests/test_common.cpp to handle the new return type and properly call the Arrow release function if the import fails.

Breaking Changes

The signature of lancedb_record_batch_reader_from_arrow in include/lancedb.h has changed.

Checklist

Sign up for free to 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.

Double free risk in lancedb_record_batch_reader_from_arrow with Arrow FFI array on error path

1 participant