Skip to content

Remove workaround for schema() in C-API#380

Merged
CGodiksen merged 5 commits intomainfrom
bug/capi-model-table-schema
Mar 19, 2026
Merged

Remove workaround for schema() in C-API#380
CGodiksen merged 5 commits intomainfrom
bug/capi-model-table-schema

Conversation

@CGodiksen
Copy link
Copy Markdown
Collaborator

This PR closes #316 by removing the workaround implemented due to the bug described in that issue and testing that it works without the workaround. Instead of creating an empty record batch to return just the schema, we now just write the schema to a schema pointer.

It should be noted that it is unclear what the difference is between this implementation and the implementation that caused the bug in the first place. Most likely, the bug was fixed by an update in pyarrow or one of our other dependencies. However, the steps to reproduce the bug described in #316 have been followed and the tests have been run repeatedly to ensure the bug is fixed.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the prior C-API workaround for retrieving a table schema (returning an empty RecordBatch) and instead exports the schema directly via the Arrow C Data Interface, addressing the intermittent PyArrow import failure described in #316.

Changes:

  • Update the embedded C-API modelardb_embedded_schema to write directly to an ArrowSchema* (no empty RecordBatch).
  • Update the Python bindings to call the new C-API signature and import the schema via Schema._import_from_c.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/modelardb_embedded/src/capi.rs Simplifies schema export to write an FFI_ArrowSchema directly to the provided pointer.
crates/modelardb_embedded/bindings/python/modelardb/operations.py Updates the cffi signature and schema() implementation to import from an ArrowSchema* pointer.

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

@CGodiksen CGodiksen requested a review from chrthomsen March 18, 2026 09:48
@CGodiksen CGodiksen merged commit 30f723a into main Mar 19, 2026
5 checks passed
@CGodiksen CGodiksen deleted the bug/capi-model-table-schema branch March 19, 2026 15:11
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.

DataFolder.schema() may return an error for model table schema

4 participants