Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions datafusion-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ rust-version = { workspace = true }
all-features = true

[features]
default = []
default = ["gcs", "http", "s3"]
backtrace = ["datafusion/backtrace"]
gcs = ["object_store/gcp"]
http = ["object_store/http"]
s3 = ["dep:aws-config", "dep:aws-credential-types", "object_store/aws"]

[dependencies]
arrow = { workspace = true }
async-trait = { workspace = true }
aws-config = "1.8.18"
aws-credential-types = "1.2.13"
aws-config = { version = "1.8.18", optional = true }
aws-credential-types = { version = "1.2.13", optional = true }
chrono = { workspace = true }
clap = { version = "4.5.60", features = ["cargo", "derive"] }
datafusion = { workspace = true, features = [
Expand All @@ -61,7 +64,7 @@ env_logger = { workspace = true }
futures = { workspace = true }
log = { workspace = true }
mimalloc = { version = "0.1", default-features = false }
object_store = { workspace = true, features = ["aws", "gcp", "http"] }
object_store = { workspace = true }
parking_lot = { workspace = true }
parquet = { workspace = true, default-features = false }
regex = { workspace = true }
Expand Down
8 changes: 7 additions & 1 deletion datafusion-cli/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

use std::sync::{Arc, Weak};

use crate::object_storage::{AwsOptions, GcpOptions, get_object_store};
#[cfg(feature = "s3")]
use crate::object_storage::AwsOptions;
#[cfg(feature = "gcs")]
use crate::object_storage::GcpOptions;
use crate::object_storage::get_object_store;

use datafusion::catalog::{CatalogProvider, CatalogProviderList, SchemaProvider};

Expand Down Expand Up @@ -169,11 +173,13 @@ impl SchemaProvider for DynamicObjectStoreSchemaProvider {
// Register the store for this URL. Here we don't have access
// to any command options so the only choice is to use an empty collection
match scheme {
#[cfg(feature = "s3")]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Only way I could think of to disable this one was,

        #[cfg_attr(not(any(feature = "s3", feature = "gcs")), expect(unused_mut))]
        let mut builder = SessionStateBuilder::from(state.clone());

"s3" | "oss" | "cos" => {
if let Some(table_options) = builder.table_options() {
table_options.extensions.insert(AwsOptions::default())
}
}
#[cfg(feature = "gcs")]
"gs" | "gcs" => {
if let Some(table_options) = builder.table_options() {
table_options.extensions.insert(GcpOptions::default())
Expand Down
7 changes: 6 additions & 1 deletion datafusion-cli/src/cli_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ use datafusion::{
};
use object_store::ObjectStore;

use crate::object_storage::{AwsOptions, GcpOptions};
#[cfg(feature = "s3")]
use crate::object_storage::AwsOptions;
#[cfg(feature = "gcs")]
use crate::object_storage::GcpOptions;

#[async_trait::async_trait]
/// The CLI session context trait provides a way to have a session context that can be used with datafusion's CLI code.
Expand Down Expand Up @@ -74,11 +77,13 @@ impl CliSessionContext for SessionContext {

fn register_table_options_extension_from_scheme(&self, scheme: &str) {
match scheme {
#[cfg(feature = "s3")]
// For Amazon S3 or Alibaba Cloud OSS
"s3" | "oss" | "cos" => {
// Register AWS specific table options in the session context:
self.register_table_options_extension(AwsOptions::default())
}
#[cfg(feature = "gcs")]
// For Google Cloud Storage
"gs" | "gcs" => {
// Register GCP specific table options in the session context:
Expand Down
Loading
Loading