Skip to content

Commit

Permalink
fix wasm build
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal committed Jun 2, 2024
1 parent c32ccd0 commit 4654397
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
5 changes: 2 additions & 3 deletions datafusion/core/src/catalog/dynamic_file_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

use crate::catalog::schema::SchemaProvider;
use crate::catalog::{CatalogProvider, CatalogProviderList};
use crate::datasource::file_format::get_object_store;
#[cfg(not(target_arch = "wasm32"))]
use crate::datasource::file_format::object_storage::{
get_object_store, AwsOptions, GcpOptions,
};
use crate::datasource::file_format::object_storage::{AwsOptions, GcpOptions};
use crate::datasource::listing::{ListingTable, ListingTableConfig, ListingTableUrl};
use crate::datasource::TableProvider;
use crate::execution::context::SessionState;
Expand Down
26 changes: 25 additions & 1 deletion datafusion/core/src/datasource/file_format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ use crate::error::Result;
use crate::execution::context::SessionState;
use crate::physical_plan::{ExecutionPlan, Statistics};

use datafusion_common::not_impl_err;
use datafusion_common::{not_impl_err, DataFusionError};
use datafusion_physical_expr::{PhysicalExpr, PhysicalSortRequirement};

use async_trait::async_trait;
use datafusion_common::config::TableOptions;
use object_store::{ObjectMeta, ObjectStore};
use url::Url;

/// This trait abstracts all the file format specific implementations
/// from the [`TableProvider`]. This helps code re-utilization across
Expand Down Expand Up @@ -108,6 +110,28 @@ pub trait FileFormat: Send + Sync + fmt::Debug {
}
}

/// Get the object store for the given scheme and url. Only available when not targeting wasm32.
#[cfg(not(target_arch = "wasm32"))]
pub async fn get_object_store(
state: &SessionState,
scheme: &str,
url: &Url,
table_options: &TableOptions,
) -> Result<Arc<dyn ObjectStore>, DataFusionError> {
object_storage::get_object_store(state, scheme, url, table_options).await
}

/// Get the object store for the given scheme and url. Only available when targeting wasm32.
#[cfg(target_arch = "wasm32")]
pub async fn get_object_store(
state: &SessionState,
scheme: &str,
url: &Url,
table_options: &TableOptions,
) -> Result<Arc<dyn ObjectStore>, DataFusionError> {
unimplemented!("Object storage is not supported in WASM")
}

#[cfg(test)]
pub(crate) mod test_util {
use std::ops::Range;
Expand Down

0 comments on commit 4654397

Please sign in to comment.