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

fix: Generic object store access implementation #2709

Merged
merged 6 commits into from
Mar 5, 2024
Merged

Conversation

vrongmeal
Copy link
Contributor

Generic store access is now simply Arc<dyn ObjStoreAccess>.

This also fixes BSON and JSON globbing issue.

> select * from 'file_*.bson';
┌─────────┐
│ column1 │
│      ── │
│   Int64 │
╞═════════╡
│       1 │
│       2 │
│       3 │
└─────────┘

Generic store access is now simply `Arc<dyn ObjStoreAccess>`.

This also fixes BSON and JSON globbing issue.

```
> select * from 'file_*.bson';
┌─────────┐
│ column1 │
│      ── │
│   Int64 │
╞═════════╡
│       1 │
│       2 │
│       3 │
└─────────┘
```

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
Comment on lines 65 to +68
let (source_url, storage_options) = table_location_and_opts(ctx, args, &mut opts)?;

let url = match source_url {
DatasourceUrl::File(path) => DatasourceUrl::File(resolve_path(&path)?),
DatasourceUrl::Url(_) => source_url,
};

let store_access = GenericStoreAccess::new_from_location_and_opts(
url.to_string().as_str(),
storage_options,
)?;
let store_access = storage_options_into_store_access(&source_url, &storage_options)
.map_err(ExtensionError::access)?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

sort of feels like we should just combine the table_location_and_opts with storage_options_into_store_access into one function as neither is particularly useful without the other.

Also, can we just implement the appropriate From<> for the storage_options_into_store_access error type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sort of feels like we should just combine the table_location_and_opts with storage_options_into_store_access into one function as neither is particularly useful without the other.

I don't think so. table_location_and_opts is used only for function implementations.

Also, can we just implement the appropriate From<> for the storage_options_into_store_access error type?

Sure! Will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, can we just implement the appropriate From<> for the storage_options_into_store_access error type?

So, we can't really do that because this is a trait method returning ExtensionError (which lies in datafusion_ext crate).

Copy link
Collaborator

Choose a reason for hiding this comment

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

alas!

makes sense.

))
})?;

let access = Arc::new(AzureStoreAccess {
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like we might want a constructor for AzureStoreAccess that parse'd the key and the URI rather than needing callers to do this correctly each time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense!

@tychoish
Copy link
Collaborator

tychoish commented Mar 5, 2024

I'm excited for this to land, as there are a number of tests related to #2729 that we can expand and improve upon.

@vrongmeal vrongmeal marked this pull request as ready for review March 5, 2024 12:54
Signed-off-by: Vaibhav <vrongmeal@gmail.com>
Signed-off-by: Vaibhav <vrongmeal@gmail.com>
@vrongmeal vrongmeal merged commit 7f1a490 into main Mar 5, 2024
25 checks passed
@vrongmeal vrongmeal deleted the vrongmeal/glob-fix branch March 5, 2024 14:43
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.

None yet

2 participants