Skip to content

Commit

Permalink
Prepare for object_store 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed May 17, 2023
1 parent 9f808f4 commit ec53cb3
Show file tree
Hide file tree
Showing 15 changed files with 141 additions and 79 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ opt-level = 3
overflow-checks = false
panic = 'unwind'
rpath = false

[patch.crates-io]
object_store = { git = "https://github.com/tustvold/arrow-rs.git", rev = "99640d16c02769726d4c0c6cc9bfda7e605a62d8" }
100 changes: 52 additions & 48 deletions datafusion-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion datafusion-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ datafusion = { path = "../datafusion/core", version = "24.0.0" }
dirs = "4.0.0"
env_logger = "0.9"
mimalloc = { version = "0.1", default-features = false }
object_store = { version = "0.5.5", features = ["aws", "gcp", "aws_profile"] }
object_store = { version = "0.5.5", features = ["aws", "gcp"] }
parking_lot = { version = "0.12" }
rustyline = "10.0"
tokio = { version = "1.24", features = ["macros", "rt", "rt-multi-thread", "sync", "parking_lot"] }
url = "2.2"
aws-config = "0.55"
aws-credential-types = "0.55"

[patch.crates-io]
object_store = { git = "https://github.com/tustvold/arrow-rs.git", rev = "99640d16c02769726d4c0c6cc9bfda7e605a62d8" }
9 changes: 6 additions & 3 deletions datafusion-cli/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ async fn exec_and_print(
let plan = ctx.state().create_logical_plan(&sql).await?;
let df = match &plan {
LogicalPlan::Ddl(DdlStatement::CreateExternalTable(cmd)) => {
create_external_table(&ctx, cmd)?;
create_external_table(&ctx, cmd).await?;
ctx.execute_logical_plan(plan).await?
}
_ => ctx.execute_logical_plan(plan).await?,
Expand All @@ -191,15 +191,18 @@ async fn exec_and_print(
Ok(())
}

fn create_external_table(ctx: &SessionContext, cmd: &CreateExternalTable) -> Result<()> {
async fn create_external_table(
ctx: &SessionContext,
cmd: &CreateExternalTable,
) -> Result<()> {
let table_path = ListingTableUrl::parse(&cmd.location)?;
let scheme = table_path.scheme();
let url: &Url = table_path.as_ref();

// registering the cloud object store dynamically using cmd.options
let store = match scheme {
"s3" => {
let builder = get_s3_object_store_builder(url, cmd)?;
let builder = get_s3_object_store_builder(url, cmd).await?;
Arc::new(builder.build()?) as Arc<dyn ObjectStore>
}
"oss" => {
Expand Down
Loading

0 comments on commit ec53cb3

Please sign in to comment.