feat(datafusion): allow configuring SQLContext runtime resources - #675
Open
shyjsarah wants to merge 1 commit into
Open
feat(datafusion): allow configuring SQLContext runtime resources#675shyjsarah wants to merge 1 commit into
shyjsarah wants to merge 1 commit into
Conversation
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.
Purpose
Linked issue: close #673
SQLContextcurrently always creates a DataFusion session with the defaultRuntimeEnv. Applications embedding Paimon Rust cannot provide a bounded execution memory pool, choose a spill policy, select a temporary directory, or cap temporary disk usage without replacing Paimon's SQL context and its custom planners and functions.This change makes DataFusion runtime resources configurable while preserving the existing zero-configuration behavior.
Brief change log
SQLContextBuilderthat accepts anArc<RuntimeEnv>.SQLContext::new()unchanged and delegate its construction through the builder.SQLContextarguments for:memory_pool_type(fairorgreedy)memory_pool_bytestemp_directorymax_temp_directory_size_bytesRuntimeEnvinjection.Tests
cargo fmt --all -- --checkPYO3_PYTHON=bindings/python/.venv/bin/python cargo clippy -p paimon-datafusion -p pypaimon_rust --all-targets --features fulltext -- -D warningscargo test -p paimon-datafusion test_sql_context_builder_uses_custom_runtime_env --libmake builduv run --no-sync pytest tests/test_datafusion.py -k 'runtime_resource_configuration' -qAPI and Format
This adds public Rust and Python APIs. Existing constructors remain backward compatible. There is no storage-format change.
Documentation
The Python binding documentation now includes a bounded-memory and local-spill example and clarifies that DataFusion's memory pool does not account for every host or external-library allocation.
AI assistance
AI tooling was used to help implement and test this change. I reviewed the builder, Python binding, DataFusion memory-pool selection, temporary-directory behavior, and compatibility path end-to-end. The primary known limitation is the one documented above: DataFusion memory pools only account for allocations registered with the pool, and only spill-capable operators can move intermediate state to disk.