Skip to content

Conversation

@OussamaSaoudi
Copy link
Contributor

@OussamaSaoudi OussamaSaoudi commented Sep 22, 2024

Which issue does this PR close?

Closes #12553

Rationale for this change

This PR provides an API for adding ObjectStores to a SessionStateBuilder's RuntimeEnv by introducing the new method: SessionStateBuilder::with_object_store.

What changes are included in this PR?

Are these changes tested?

I add a doctest to document and validate the new method.

Are there any user-facing changes?

None

@github-actions github-actions bot added the core Core DataFusion crate label Sep 22, 2024
url: &Url,
object_store: Arc<dyn ObjectStore>,
) -> Self {
if self.runtime_env.is_none() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue #12553 proposes creating a method runtime_env to set the default and return a reference as the author does here. However, there already is a method runtime_env and its signature doesn't mesh well with that proposal. Currently I set a default runtime in with_object_store instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

@OussamaSaoudi OussamaSaoudi marked this pull request as ready for review September 22, 2024 07:41
This PR adds the the method `SessionStateBuilder::with_object_store`,
which registers an object store with a specified URL to the RuntimeEnv.
@OussamaSaoudi OussamaSaoudi force-pushed the session_state_bulider_obj_store branch from 3562b8d to f676722 Compare September 22, 2024 07:45
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you (again) @OussamaSaoudi -- this looks great.

I think your comments about with_runtime_env make lots of sense

url: &Url,
object_store: Arc<dyn ObjectStore>,
) -> Self {
if self.runtime_env.is_none() {
Copy link
Contributor

Choose a reason for hiding this comment

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

/// Register an `ObjectStore` to the [`RuntimeEnv`]. See [`RuntimeEnv::register_object_store`]
/// for more details.
///
/// Note that this creates a default [`RuntimeEnv`] if there isn't one passed in already.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@alamb alamb merged commit a35d007 into apache:main Sep 23, 2024
@alamb
Copy link
Contributor

alamb commented Sep 23, 2024

Thanks again @OussamaSaoudi

bgjackma pushed a commit to bgjackma/datafusion that referenced this pull request Sep 25, 2024
This PR adds the the method `SessionStateBuilder::with_object_store`,
which registers an object store with a specified URL to the RuntimeEnv.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Register object stores via SessionStateBuilder

2 participants