Skip to content

Commit

Permalink
feat: add datafusion to the list
Browse files Browse the repository at this point in the history
Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia committed Jan 12, 2024
1 parent a58eac6 commit df30de2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ path = "src/lib.rs"
# Used to enable the avro format
avro = ["apache-avro", "num-traits", "datafusion-common/avro"]
backtrace = ["datafusion-common/backtrace"]
compression = ["xz2", "bzip2", "flate2", "zstd", "async-compression"]
compression = ["xz2", "bzip2", "flate2", "zstd", "async-compression", "tokio-util"]
crypto_expressions = ["datafusion-physical-expr/crypto_expressions", "datafusion-optimizer/crypto_expressions"]
default = ["crypto_expressions", "encoding_expressions", "regex_expressions", "unicode_expressions", "compression", "parquet"]
encoding_expressions = ["datafusion-physical-expr/encoding_expressions"]
Expand Down Expand Up @@ -87,8 +87,8 @@ pin-project-lite = "^0.2.7"
rand = { workspace = true }
sqlparser = { workspace = true }
tempfile = { workspace = true }
tokio = { version = "1.28", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] }
tokio-util = { version = "0.7.4", features = ["io"] }
tokio = { version = "1.28", features = ["macros", "rt", "sync"] }
tokio-util = { version = "0.7.4", features = ["io"], optional = true }
url = { workspace = true }
uuid = { version = "1.0", features = ["v4"] }
xz2 = { version = "0.1", optional = true }
Expand All @@ -113,6 +113,7 @@ rust_decimal = { version = "1.27.0", features = ["tokio-pg"] }
serde_json = { workspace = true }
test-utils = { path = "../../test-utils" }
thiserror = { workspace = true }
tokio = { version = "1.28", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] }
tokio-postgres = "0.7.7"
[target.'cfg(not(target_os = "windows"))'.dev-dependencies]
nix = { version = "0.27.1", features = ["fs"] }
Expand Down
4 changes: 4 additions & 0 deletions datafusion/core/src/datasource/listing/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ impl ListingTableUrl {
let s = s.as_ref();

// This is necessary to handle the case of a path starting with a drive letter
#[cfg(not(target_arch = "wasm32"))]
if std::path::Path::new(s).is_absolute() {
return Self::parse_path(s);
}

match Url::parse(s) {
Ok(url) => Self::try_new(url, None),
#[cfg(not(target_arch = "wasm32"))]
Err(url::ParseError::RelativeUrlWithoutBase) => Self::parse_path(s),
Err(e) => Err(DataFusionError::External(Box::new(e))),
}
Expand Down Expand Up @@ -146,6 +148,7 @@ impl ListingTableUrl {
}

/// Creates a new [`ListingTableUrl`] interpreting `s` as a filesystem path
#[cfg(not(target_arch = "wasm32"))]
fn parse_path(s: &str) -> Result<Self> {
let (path, glob) = match split_glob_expression(s) {
Some((prefix, glob)) => {
Expand Down Expand Up @@ -282,6 +285,7 @@ impl ListingTableUrl {
}

/// Creates a file URL from a potentially relative filesystem path
#[cfg(not(target_arch = "wasm32"))]
fn url_from_filesystem_path(s: &str) -> Option<Url> {
let path = std::path::Path::new(s);
let is_dir = match path.exists() {
Expand Down
1 change: 1 addition & 0 deletions datafusion/wasmtest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ datafusion-physical-expr = { workspace = true }
datafusion-sql = { workspace = true }
datafusion-execution = { workspace = true }
datafusion-physical-plan = { workspace = true }
datafusion = { path = "../core", default-features = false }

# getrandom must be compiled with js feature
getrandom = { version = "0.2.8", features = ["js"] }
Expand Down
1 change: 1 addition & 0 deletions datafusion/wasmtest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Then open http://localhost:8080/ in a web browser and check the console to see t

The following DataFusion crates are verified to work in a wasm-pack environment using the default `wasm32-unknown-unknown` target:

- `datafusion` (datafusion-core) with default-features disabled to remove `bzip2-sys` from `async-compression`
- `datafusion-common` with default-features disabled to remove the `parquet` dependency (see below)
- `datafusion-expr`
- `datafusion-execution`
Expand Down

0 comments on commit df30de2

Please sign in to comment.