Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow access to underlying storage backend #690

Closed
wjones127 opened this issue Jul 17, 2022 · 0 comments · Fixed by #761
Closed

Allow access to underlying storage backend #690

wjones127 opened this issue Jul 17, 2022 · 0 comments · Fixed by #761
Labels
binding/rust Issues for the Rust crate enhancement New feature or request

Comments

@wjones127
Copy link
Collaborator

Description

We currently don't allow external access to the underlying storage of a DeltaTable. But for the Python bindings we will need access to be able to pass the storage backend to other functions that need to do IO (see #689).

The type is currently Box<dyn StorageBackend>. We could instead making it Arc<dyn StorageBackend>, and then can allow users to retrieve the backend by cloning the Arc pointer. StorageBackend is already Send + Sync, so I don't think there should be any problem allowing shared ownership.

There are plenty of places where we create a new storage backend from a URI and storage options, when we really should just be taking an Arc<StorageBackend>. Here's a good example, IMO:

/// Create a new JsonWriter instance
pub fn try_new(
table_uri: String,
schema: ArrowSchemaRef,
partition_columns: Option<Vec<String>>,
storage_options: Option<HashMap<String, String>>,
) -> Result<Self, DeltaWriterError> {
let storage =
get_backend_for_uri_with_options(&table_uri, storage_options.unwrap_or_default())?;

Use Case

In Python, we need to extract the storage backend so we can pass the filesystem to PyArrow functions such as the dataset scanner.

Related Issue(s)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/rust Issues for the Rust crate enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant