Skip to content

Apache DataFusion SQL Query Engine

Support gs:// as GCS schema (#4930)

Rich489a555644cd
diff --git a/datafusion-cli/src/object_storage.rs b/datafusion-cli/src/object_storage.rs
index 177b12717c..ba18f11ba3 100644
--- a/datafusion-cli/src/object_storage.rs
+++ b/datafusion-cli/src/object_storage.rs
@@ -34,7 +34,7 @@ impl FromStr for ObjectStoreScheme {
fn from_str(input: &str) -> Result<Self> {
match input {
"s3" => Ok(ObjectStoreScheme::S3),
- "gcs" => Ok(ObjectStoreScheme::GCS),
+ "gs" | "gcs" => Ok(ObjectStoreScheme::GCS),
_ => Err(DataFusionError::Execution(format!(
"Unsupported object store scheme {}",
input
@@ -107,6 +107,18 @@ mod tests {
.contains("Not able to parse hostname from url"))
}
+ #[test]
+ fn gs_provider_no_host() {
+ let no_host_url = "gs:///";
+ let provider = DatafusionCliObjectStoreProvider {};
+ let err = provider
+ .get_by_url(&Url::from_str(no_host_url).unwrap())
+ .unwrap_err();
+ assert!(err
+ .to_string()
+ .contains("Not able to parse hostname from url"))
+ }
+
#[test]
fn gcs_provider_no_host() {
let no_host_url = "gcs:///";