@@ -11,8 +11,10 @@ use pgrx::{ereport, PgLogLevel, PgSqlErrorCode};
1111use url:: Url ;
1212
1313use super :: {
14- aws:: parse_s3_bucket, azure:: parse_azure_blob_container, create_azure_object_store,
15- create_local_file_object_store, create_s3_object_store,
14+ aws:: parse_s3_bucket,
15+ azure:: parse_azure_blob_container,
16+ create_azure_object_store, create_local_file_object_store, create_s3_object_store,
17+ gcs:: { create_gcs_object_store, parse_gcs_bucket} ,
1618} ;
1719
1820// OBJECT_STORE_CACHE is a global cache for object stores per Postgres session.
@@ -44,7 +46,7 @@ impl ObjectStoreCache {
4446 fn get_or_create ( & mut self , uri : & Url , copy_from : bool ) -> ( Arc < dyn ObjectStore > , Path ) {
4547 let ( scheme, path) = ObjectStoreScheme :: parse ( uri) . unwrap_or_else ( |_| {
4648 panic ! (
47- "unrecognized uri {}. pg_parquet supports local paths, s3:// or azure :// schemes." ,
49+ "unrecognized uri {}. pg_parquet supports local paths, s3://, azure:// or gs :// schemes." ,
4850 uri
4951 )
5052 } ) ;
@@ -74,13 +76,14 @@ impl ObjectStoreCache {
7476
7577 fn create ( scheme : ObjectStoreScheme , uri : & Url , copy_from : bool ) -> ObjectStoreWithExpiration {
7678 // object_store crate can recognize a bunch of different schemes and paths, but we only support
77- // local, azure, and s3 schemes with a subset of all supported paths.
79+ // local, s3, azure and gs schemes with a subset of all supported paths.
7880 match scheme {
7981 ObjectStoreScheme :: AmazonS3 => create_s3_object_store ( uri) ,
8082 ObjectStoreScheme :: MicrosoftAzure => create_azure_object_store ( uri) ,
83+ ObjectStoreScheme :: GoogleCloudStorage => create_gcs_object_store ( uri) ,
8184 ObjectStoreScheme :: Local => create_local_file_object_store ( uri, copy_from) ,
8285 _ => panic ! (
83- "unsupported scheme {} in uri {}. pg_parquet supports local paths, s3:// or azure :// schemes." ,
86+ "unsupported scheme {} in uri {}. pg_parquet supports local paths, s3://, azure:// or gs :// schemes." ,
8487 uri. scheme( ) ,
8588 uri
8689 ) ,
@@ -131,9 +134,10 @@ impl ObjectStoreCacheKey {
131134 let bucket = match scheme {
132135 ObjectStoreScheme :: AmazonS3 => parse_s3_bucket ( uri) . unwrap_or_else ( || panic ! ( "unsupported s3 uri: {uri}" ) ) ,
133136 ObjectStoreScheme :: MicrosoftAzure => parse_azure_blob_container ( uri) . unwrap_or_else ( || panic ! ( "unsupported azure blob storage uri: {uri}" ) ) ,
137+ ObjectStoreScheme :: GoogleCloudStorage => parse_gcs_bucket ( uri) . unwrap_or_else ( || panic ! ( "unsupported gs uri: {uri}" ) ) ,
134138 ObjectStoreScheme :: Local => panic ! ( "local paths should not be cached" ) ,
135139 _ => panic ! (
136- "unsupported scheme {} in uri {}. pg_parquet supports local paths, s3:// or azure :// schemes." ,
140+ "unsupported scheme {} in uri {}. pg_parquet supports local paths, s3://, azure:// or gs :// schemes." ,
137141 uri. scheme( ) ,
138142 uri
139143 ) ,
0 commit comments