-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Minor: Move ObjectStoreRegistry
to datafusion_execution crate
#5478
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,9 +23,11 @@ use crate::{ | |
execution::disk_manager::{DiskManager, DiskManagerConfig}, | ||
}; | ||
|
||
use crate::datasource::object_store::ObjectStoreRegistry; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the point of this PR is to remove the dependency here on The other references to datasource are removed in #5477 |
||
use crate::execution::memory_pool::{GreedyMemoryPool, MemoryPool, UnboundedMemoryPool}; | ||
use datafusion_common::DataFusionError; | ||
use datafusion_execution::{ | ||
memory_pool::{GreedyMemoryPool, MemoryPool, UnboundedMemoryPool}, | ||
object_store::ObjectStoreRegistry, | ||
}; | ||
use object_store::ObjectStore; | ||
use std::fmt::{Debug, Formatter}; | ||
use std::path::PathBuf; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,5 @@ | |
|
||
pub mod disk_manager; | ||
pub mod memory_pool; | ||
pub mod object_store; | ||
pub mod registry; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,22 +217,12 @@ impl ObjectStoreRegistry { | |
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use crate::datasource::listing::ListingTableUrl; | ||
use std::sync::Arc; | ||
|
||
#[test] | ||
fn test_object_store_url() { | ||
let listing = ListingTableUrl::parse("file:///").unwrap(); | ||
let store = listing.object_store(); | ||
assert_eq!(store.as_str(), "file:///"); | ||
|
||
let file = ObjectStoreUrl::parse("file://").unwrap(); | ||
assert_eq!(file.as_str(), "file:///"); | ||
|
||
let listing = ListingTableUrl::parse("s3://bucket/").unwrap(); | ||
let store = listing.object_store(); | ||
assert_eq!(store.as_str(), "s3://bucket/"); | ||
|
||
let url = ObjectStoreUrl::parse("s3://bucket").unwrap(); | ||
assert_eq!(url.as_str(), "s3://bucket/"); | ||
|
||
|
@@ -255,34 +245,4 @@ mod tests { | |
ObjectStoreUrl::parse("s3://username:password@host:123/foo").unwrap_err(); | ||
assert_eq!(err.to_string(), "Execution error: ObjectStoreUrl must only contain scheme and authority, got: /foo"); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved this into the datasource/listing module |
||
#[test] | ||
fn test_get_by_url_hdfs() { | ||
let sut = ObjectStoreRegistry::default(); | ||
sut.register_store("hdfs", "localhost:8020", Arc::new(LocalFileSystem::new())); | ||
let url = ListingTableUrl::parse("hdfs://localhost:8020/key").unwrap(); | ||
sut.get_by_url(&url).unwrap(); | ||
} | ||
|
||
#[test] | ||
fn test_get_by_url_s3() { | ||
let sut = ObjectStoreRegistry::default(); | ||
sut.register_store("s3", "bucket", Arc::new(LocalFileSystem::new())); | ||
let url = ListingTableUrl::parse("s3://bucket/key").unwrap(); | ||
sut.get_by_url(&url).unwrap(); | ||
} | ||
|
||
#[test] | ||
fn test_get_by_url_file() { | ||
let sut = ObjectStoreRegistry::default(); | ||
let url = ListingTableUrl::parse("file:///bucket/key").unwrap(); | ||
sut.get_by_url(&url).unwrap(); | ||
} | ||
|
||
#[test] | ||
fn test_get_by_url_local() { | ||
let sut = ObjectStoreRegistry::default(); | ||
let url = ListingTableUrl::parse("../").unwrap(); | ||
sut.get_by_url(&url).unwrap(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these tests are of
ListingTableUrl
which is in core/src/datasource/listing I moved them here