Add missing registration methods#1474
Merged
timsaucer merged 11 commits intoapache:mainfrom Apr 8, 2026
Merged
Conversation
…tches Add read_arrow, read_empty, register_arrow, and register_batch methods to SessionContext, exposing upstream DataFusion v53 functionality. The write_* methods and read_batch/read_batches are already covered by DataFrame.write_* and SessionContext.from_arrow respectively. Closes apache#1458. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to expose additional upstream DataFusion SessionContext APIs in datafusion-python and add Python unit tests to validate the new bindings.
Changes:
- Added
SessionContext.register_batch()andSessionContext.register_arrow()bindings. - Added
SessionContext.read_arrow()andSessionContext.read_empty()bindings. - Added unit tests covering Arrow IPC read/registration and RecordBatch registration.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
crates/core/src/context.rs |
Adds PyO3 bindings for Arrow IPC read/register, batch registration, and an empty DataFrame read method. |
python/datafusion/context.py |
Exposes the new bindings on the public Python SessionContext wrapper. |
python/tests/test_context.py |
Adds tests for read_arrow, read_empty, register_arrow, and register_batch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…lias for empty_table Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
d7555e7 to
03092ed
Compare
ntjohnson1
approved these changes
Apr 6, 2026
…rings Demonstrate schema= and file_extension= keyword arguments in the docstring examples for register_arrow and read_arrow, following project guidelines for optional parameter documentation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Follow the same See Also alias convention used in functions.py since read_empty is a simple alias for empty_table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoid shared SessionContext state across doctests by having each docstring example create its own ctx instance, matching the pattern used throughout the rest of the codebase. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The pa alias is already provided by the doctest namespace in conftest.py, so inline imports are unnecessary. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #1458
Rationale for this change
These functions are available in the upstream repo but not exposed in Python
What changes are included in this PR?
Expose functions
Add unit tests
Are there any user-facing changes?
Addition only