diff --git a/.github/workflows/build-wasm.yml b/.github/workflows/build-wasm.yml new file mode 100644 index 00000000..06b57c3d --- /dev/null +++ b/.github/workflows/build-wasm.yml @@ -0,0 +1,24 @@ +name: Build WASM +on: + pull_request: + branches: + - main + paths: + - src/** + - configure* + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build wasm package + uses: r-wasm/actions/build-rwasm@main + with: + packages: | + local::. diff --git a/src/Makevars.in b/src/Makevars.in index 513f9bb4..dfa0ead0 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -10,6 +10,10 @@ PKG_LIBS = -L$(LIBDIR) -lr_polars CARGO_BUILD_ARGS = --lib --profile $(PROFILE) --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) +# Some features should be removed when building for WASM, as like Python Polars +# +WASM_INCOMPATIBLE_FEATURES = parquet|async|json|extract_jsonpath|cloud|polars_cloud|tokio|clipboard|decompress|new_streaming + all: C_clean $(SHLIB): $(STATLIB) @@ -22,6 +26,9 @@ $(STATLIB): if [ "$(TARGET)" != "wasm32-unknown-emscripten" ]; then \ cargo build $(CARGO_BUILD_ARGS); \ else \ + sed -E -i \ + -e "/^\s*\"($(WASM_INCOMPATIBLE_FEATURES))\",$$/d" \ + ./rust/Cargo.toml && \ export CC="$(CC)" && \ export CFLAGS="$(CFLAGS)" && \ export CARGO_PROFILE_DEV_PANIC="abort" && \ diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 42ec0610..ac582ce0 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -121,18 +121,18 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] name = "async-trait" -version = "0.1.85" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.7.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" dependencies = [ "serde", ] @@ -258,7 +258,7 @@ checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -287,9 +287,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.8" +version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0cf6e91fde44c773c6ee7ec6bba798504641a8bc2eb7e37a04ffbf4dfaa55a" +checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" dependencies = [ "jobserver", "libc", @@ -383,9 +383,9 @@ dependencies = [ [[package]] name = "compact_str" -version = "0.8.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32" +checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" dependencies = [ "castaway", "cfg-if", @@ -506,7 +506,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -533,7 +533,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -542,16 +542,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "erased-serde" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d" -dependencies = [ - "serde", - "typeid", -] - [[package]] name = "errno" version = "0.3.10" @@ -698,7 +688,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -765,9 +755,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" @@ -1095,7 +1085,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -1237,9 +1227,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.15" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "litemap" @@ -1259,12 +1249,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.24" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6ea2a48c204030ee31a7d7fc72c93294c92fe87ecb1789881c9543516e1a0d" -dependencies = [ - "value-bag", -] +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "loom" @@ -1283,9 +1270,9 @@ dependencies = [ [[package]] name = "lz4" -version = "1.28.1" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20b523e860d03443e98350ceaac5e71c6ba89aea7d960769ec3ce37f4de5af4" +checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" dependencies = [ "lz4-sys", ] @@ -1439,9 +1426,9 @@ dependencies = [ [[package]] name = "object_store" -version = "0.11.2" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfccb68961a56facde1163f9319e0d15743352344e7808a11795fb99698dcaf" +checksum = "6eb4c22c6154a1e759d7099f9ffad7cc5ef8245f9efbab4a41b92623079c82f3" dependencies = [ "async-trait", "base64", @@ -1524,18 +1511,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "phf" -version = "0.11.3" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ "phf_shared", ] [[package]] name = "phf_codegen" -version = "0.11.3" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ "phf_generator", "phf_shared", @@ -1543,9 +1530,9 @@ dependencies = [ [[package]] name = "phf_generator" -version = "0.11.3" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ "phf_shared", "rand", @@ -1553,18 +1540,18 @@ dependencies = [ [[package]] name = "phf_shared" -version = "0.11.3" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ "siphasher", ] [[package]] name = "pin-project-lite" -version = "0.2.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -2131,9 +2118,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2149,9 +2136,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.37.2" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165859e9e55f79d67b96c5d96f4e88b6f2695a1972849c15a6a3f5c59fc2c003" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" dependencies = [ "memchr", "serde", @@ -2211,9 +2198,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.38" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -2323,7 +2310,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76009fbe0614077fc1a2ce255e3a1881a2e3a3527097d5dc6d8212c585e7e38b" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -2352,7 +2339,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -2401,9 +2388,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.12" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64", "bytes", @@ -2435,7 +2422,6 @@ dependencies = [ "tokio", "tokio-rustls", "tokio-util", - "tower", "tower-service", "url", "wasm-bindgen", @@ -2474,9 +2460,9 @@ checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustix" -version = "0.38.43" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags", "errno", @@ -2487,9 +2473,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.21" +version = "0.23.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8" +checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "once_cell", "ring", @@ -2542,9 +2528,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.19" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -2582,7 +2568,7 @@ checksum = "79236364f88e6dd77ceb6663569c47cb8b94cf855d06b929d5f9a03fe7202339" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -2600,7 +2586,7 @@ dependencies = [ "proc-macro2", "quote", "savvy-bindgen", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -2626,9 +2612,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "3.2.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +checksum = "81d3f8c9bfcc3cbb6b0179eb57042d75b1582bdc65c3cb95f3fa999509c03cbc" dependencies = [ "bitflags", "core-foundation", @@ -2639,9 +2625,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.14.0" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +checksum = "1863fd3768cd83c56a7f60faa4dc0d403f1b6df0a38c3c25f44b7894e45370d5" dependencies = [ "core-foundation-sys", "libc", @@ -2649,38 +2635,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.217" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.217" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", -] - -[[package]] -name = "serde_fmt" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d4ddca14104cd60529e8c7f7ba71a2c8acd8f7f5cfcdc2faf97eeb7c3010a4" -dependencies = [ - "serde", + "syn 2.0.91", ] [[package]] name = "serde_json" -version = "1.0.135" +version = "1.0.134" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" +checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" dependencies = [ "indexmap", "itoa", @@ -2741,9 +2718,9 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "siphasher" -version = "1.0.1" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" @@ -2787,7 +2764,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -2895,7 +2872,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -2904,84 +2881,6 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[package]] -name = "sval" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6dc0f9830c49db20e73273ffae9b5240f63c42e515af1da1fceefb69fceafd8" - -[[package]] -name = "sval_buffer" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "429922f7ad43c0ef8fd7309e14d750e38899e32eb7e8da656ea169dd28ee212f" -dependencies = [ - "sval", - "sval_ref", -] - -[[package]] -name = "sval_dynamic" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f16ff5d839396c11a30019b659b0976348f3803db0626f736764c473b50ff4" -dependencies = [ - "sval", -] - -[[package]] -name = "sval_fmt" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01c27a80b6151b0557f9ccbe89c11db571dc5f68113690c1e028d7e974bae94" -dependencies = [ - "itoa", - "ryu", - "sval", -] - -[[package]] -name = "sval_json" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0deef63c70da622b2a8069d8600cf4b05396459e665862e7bdb290fd6cf3f155" -dependencies = [ - "itoa", - "ryu", - "sval", -] - -[[package]] -name = "sval_nested" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a39ce5976ae1feb814c35d290cf7cf8cd4f045782fe1548d6bc32e21f6156e9f" -dependencies = [ - "sval", - "sval_buffer", - "sval_ref", -] - -[[package]] -name = "sval_ref" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7c6ee3751795a728bc9316a092023529ffea1783499afbc5c66f5fabebb1fa" -dependencies = [ - "sval", -] - -[[package]] -name = "sval_serde" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5572d0321b68109a343634e3a5d576bf131b82180c6c442dee06349dfc652a" -dependencies = [ - "serde", - "sval", - "sval_nested", -] - [[package]] name = "syn" version = "1.0.109" @@ -2995,9 +2894,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" dependencies = [ "proc-macro2", "quote", @@ -3021,7 +2920,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -3045,22 +2944,22 @@ checksum = "c1bbb9f3c5c463a01705937a24fdabc5047929ac764b2d5b9cf681c1f5041ed5" [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -3100,9 +2999,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.43.0" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -3116,13 +3015,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -3148,27 +3047,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tower" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - [[package]] name = "tower-service" version = "0.3.3" @@ -3194,7 +3072,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -3242,12 +3120,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "typeid" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" - [[package]] name = "unicode-ident" version = "1.0.14" @@ -3306,9 +3178,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "uuid" -version = "1.11.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b913a3b5fe84142e269d63cc62b64319ccaf89b748fc31fe025177f767a756c4" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", ] @@ -3319,42 +3191,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "value-bag" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef4c4aa54d5d05a279399bfa921ec387b7aba77caf7a682ae8d86785b8fdad2" -dependencies = [ - "value-bag-serde1", - "value-bag-sval2", -] - -[[package]] -name = "value-bag-serde1" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb773bd36fd59c7ca6e336c94454d9c66386416734817927ac93d81cb3c5b0b" -dependencies = [ - "erased-serde", - "serde", - "serde_fmt", -] - -[[package]] -name = "value-bag-sval2" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a916a702cac43a88694c97657d449775667bcd14b70419441d05b7fea4a83a" -dependencies = [ - "sval", - "sval_buffer", - "sval_dynamic", - "sval_fmt", - "sval_json", - "sval_ref", - "sval_serde", -] - [[package]] name = "value-trait" version = "0.10.1" @@ -3419,7 +3255,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", "wasm-bindgen-shared", ] @@ -3454,7 +3290,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3577,7 +3413,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -3588,7 +3424,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -3783,9 +3619,9 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" [[package]] name = "xxhash-rust" -version = "0.8.15" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd20c5420375476fbd4394763288da7eb0cc0b8c11deed431a91562af7335d3" +checksum = "d7d48f1b18be023c95e7b75f481cac649d74be7c507ff4a407c55cfb957f7934" [[package]] name = "yoke" @@ -3807,7 +3643,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", "synstructure", ] @@ -3829,7 +3665,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] @@ -3849,7 +3685,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", "synstructure", ] @@ -3878,7 +3714,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.91", ] [[package]] diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 3427a72c..8644f9da 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -110,10 +110,10 @@ features = [ "unique_counts" ] -[target.'cfg(all(any(not(target_family = "unix"), allocator = "mimalloc")))'.dependencies] +[target.'cfg(all(any(not(target_family = "unix"), target_os = "emscripten", allocator = "mimalloc")))'.dependencies] mimalloc = { version = "0.1", default-features = false } -[target.'cfg(all(target_family = "unix", not(target_os = "macos"), not(allocator = "mimalloc")))'.dependencies] +[target.'cfg(all(target_family = "unix", not(target_os = "macos"), not(target_os = "emscripten"), not(allocator = "mimalloc")))'.dependencies] jemallocator = { version = "0.5", features = [ "disable_initial_exec_tls", "background_threads", diff --git a/src/rust/src/allocator.rs b/src/rust/src/allocator.rs index 7af63bb2..985a77ac 100644 --- a/src/rust/src/allocator.rs +++ b/src/rust/src/allocator.rs @@ -1,12 +1,28 @@ -#[cfg(all(target_family = "unix", not(allocator = "mimalloc"),))] +#[cfg(all( + target_family = "unix", + not(target_os = "emscripten"), + not(allocator = "mimalloc"), +))] use jemallocator::Jemalloc; -#[cfg(all(any(not(target_family = "unix"), allocator = "mimalloc"),))] +#[cfg(all(any( + not(target_family = "unix"), + target_os = "emscripten", + allocator = "mimalloc" +),))] use mimalloc::MiMalloc; #[global_allocator] -#[cfg(all(not(allocator = "mimalloc"), target_family = "unix",))] +#[cfg(all( + not(allocator = "mimalloc"), + target_family = "unix", + not(target_os = "emscripten"), +))] static ALLOC: Jemalloc = Jemalloc; #[global_allocator] -#[cfg(all(any(not(target_family = "unix"), allocator = "mimalloc"),))] +#[cfg(all(any( + not(target_family = "unix"), + target_os = "emscripten", + allocator = "mimalloc" +),))] static ALLOC: MiMalloc = MiMalloc; diff --git a/src/rust/src/conversion/mod.rs b/src/rust/src/conversion/mod.rs index 7e4c2d01..0d6a0ab7 100644 --- a/src/rust/src/conversion/mod.rs +++ b/src/rust/src/conversion/mod.rs @@ -665,6 +665,8 @@ pub(crate) fn parse_cloud_options( Ok(out) } +// TODO: Refactor with adding `parquet` feature as like Python Polars +#[cfg(not(target_arch = "wasm32"))] impl TryFrom<&str> for Wrap { type Error = String; diff --git a/src/rust/src/expr/string.rs b/src/rust/src/expr/string.rs index 6fd09737..dc980391 100644 --- a/src/rust/src/expr/string.rs +++ b/src/rust/src/expr/string.rs @@ -134,13 +134,21 @@ impl PlRExpr { .into()) } + #[allow(unused_variables)] fn str_json_path_match(&self, pat: &PlRExpr) -> Result { - Ok(self - .inner - .clone() - .str() - .json_path_match(pat.inner.clone()) - .into()) + #[cfg(not(target_arch = "wasm32"))] + { + Ok(self + .inner + .clone() + .str() + .json_path_match(pat.inner.clone()) + .into()) + } + #[cfg(target_arch = "wasm32")] + { + Err(RPolarsErr::Other(format!("Not supported in WASM")).into()) + } } // fn str_json_decode(&self, dtype: &PlRExpr, infer_schema_len: &PlRExpr) -> Result { diff --git a/src/rust/src/expr/struct.rs b/src/rust/src/expr/struct.rs index 096c316e..c187c82b 100644 --- a/src/rust/src/expr/struct.rs +++ b/src/rust/src/expr/struct.rs @@ -26,8 +26,16 @@ impl PlRExpr { .into()) } + #[allow(unused_variables)] fn struct_json_encode(&self) -> Result { - Ok(self.inner.clone().struct_().json_encode().into()) + #[cfg(not(target_arch = "wasm32"))] + { + Ok(self.inner.clone().struct_().json_encode().into()) + } + #[cfg(target_arch = "wasm32")] + { + Err(RPolarsErr::Other(format!("Not supported in WASM")).into()) + } } fn struct_with_fields(&self, fields: ListSexp) -> Result { diff --git a/src/rust/src/lazyframe/general.rs b/src/rust/src/lazyframe/general.rs index 4ac1d665..db7c2c07 100644 --- a/src/rust/src/lazyframe/general.rs +++ b/src/rust/src/lazyframe/general.rs @@ -106,6 +106,8 @@ impl PlRLazyFrame { } let ldf = self.ldf.clone(); + + #[cfg(not(target_arch = "wasm32"))] let df = if ThreadCom::try_from_global(&CONFIG).is_ok() { ldf.collect().map_err(RPolarsErr::from)? } else { @@ -131,6 +133,9 @@ impl PlRLazyFrame { .map_err(RPolarsErr::from)? }; + #[cfg(target_arch = "wasm32")] + let df = ldf.collect().map_err(RPolarsErr::from)?; + Ok(df.into()) } @@ -253,6 +258,8 @@ impl PlRLazyFrame { try_parse_dates: try_parse_hive_dates, }; // TODO: better error message + // TODO: Refactor with adding `cloud` feature as like Python Polars + #[cfg(not(target_arch = "wasm32"))] let cloud_options = match storage_options { Some(x) => { let out = >>::try_from(x).map_err(|_| { @@ -264,6 +271,10 @@ impl PlRLazyFrame { } None => None, }; + + #[cfg(target_arch = "wasm32")] + let cloud_options: Option> = None; + let mut args = ScanArgsIpc { n_rows, cache, @@ -275,6 +286,9 @@ impl PlRLazyFrame { }; let first_path: Option = source.first().unwrap().clone().into(); + + // TODO: Refactor with adding `cloud` feature as like Python Polars + #[cfg(not(target_arch = "wasm32"))] if let Some(first_path) = first_path { let first_path_url = first_path.to_string_lossy(); let mut cloud_options = @@ -387,6 +401,8 @@ impl PlRLazyFrame { None => None, }; + // TODO: Refactor with adding `cloud` feature as like Python Polars + #[cfg(not(target_arch = "wasm32"))] let cloud_options = match storage_options { Some(x) => { let out = >>::try_from(x).map_err(|_| { @@ -399,8 +415,14 @@ impl PlRLazyFrame { None => None, }; + #[cfg(target_arch = "wasm32")] + let cloud_options: Option> = None; + let mut r = LazyCsvReader::new_paths(source.clone().into()); let first_path: Option = source.first().unwrap().clone().into(); + + // TODO: Refactor with adding `cloud` feature as like Python Polars + #[cfg(not(target_arch = "wasm32"))] if let Some(first_path) = first_path { let first_path_url = first_path.to_string_lossy(); @@ -443,6 +465,7 @@ impl PlRLazyFrame { Ok(r.finish().map_err(RPolarsErr::from)?.into()) } + #[allow(unused_variables)] fn new_from_parquet( source: StringSexp, cache: bool, @@ -463,84 +486,100 @@ impl PlRLazyFrame { hive_schema: Option, include_file_paths: Option<&str>, ) -> Result { - let source = source - .to_vec() - .iter() - .map(PathBuf::from) - .collect::>(); - let row_index_offset = >::try_from(row_index_offset)?.0; - let n_rows = match n_rows { - Some(x) => Some(>::try_from(x)?.0), - None => None, - }; - let parallel = >::try_from(parallel)?.0; - let retries = >::try_from(retries)?.0; - let hive_schema = match hive_schema { - Some(x) => Some(Arc::new(>::try_from(x)?.0)), - None => None, - }; - let schema = match schema { - Some(x) => Some(>::try_from(x)?.0), - None => None, - }; - - let row_index = match row_index_name { - Some(x) => Some(RowIndex { - name: x.into(), - offset: row_index_offset, - }), - None => None, - }; - - let hive_options = HiveOptions { - enabled: hive_partitioning, - hive_start_idx: 0, - schema: hive_schema, - try_parse_dates: try_parse_hive_dates, - }; - - let mut args = ScanArgsParquet { - n_rows, - cache, - parallel, - rechunk, - row_index, - low_memory, - cloud_options: None, - use_statistics, - schema: schema.map(|x| Arc::new(x)), - hive_options, - glob, - include_file_paths: include_file_paths.map(|x| x.into()), - allow_missing_columns, - }; - - let first_path = source.first().unwrap().clone().into(); - - let cloud_options = match storage_options { - Some(x) => { - let out = >>::try_from(x).map_err(|_| { - RPolarsErr::Other(format!( - "`storage_options` must be a named character vector" - )) - })?; - Some(out.0) + #[cfg(not(target_arch = "wasm32"))] + { + let source = source + .to_vec() + .iter() + .map(PathBuf::from) + .collect::>(); + let row_index_offset = >::try_from(row_index_offset)?.0; + let n_rows = match n_rows { + Some(x) => Some(>::try_from(x)?.0), + None => None, + }; + let parallel = >::try_from(parallel)?.0; + let retries = >::try_from(retries)?.0; + let hive_schema = match hive_schema { + Some(x) => Some(Arc::new(>::try_from(x)?.0)), + None => None, + }; + let schema = match schema { + Some(x) => Some(>::try_from(x)?.0), + None => None, + }; + + let row_index = match row_index_name { + Some(x) => Some(RowIndex { + name: x.into(), + offset: row_index_offset, + }), + None => None, + }; + + let hive_options = HiveOptions { + enabled: hive_partitioning, + hive_start_idx: 0, + schema: hive_schema, + try_parse_dates: try_parse_hive_dates, + }; + + let mut args = ScanArgsParquet { + n_rows, + cache, + parallel, + rechunk, + row_index, + low_memory, + cloud_options: None, + use_statistics, + schema: schema.map(|x| Arc::new(x)), + hive_options, + glob, + include_file_paths: include_file_paths.map(|x| x.into()), + allow_missing_columns, + }; + + let first_path = source.first().unwrap().clone().into(); + + // TODO: Refactor with adding `cloud` feature as like Python Polars + #[cfg(not(target_arch = "wasm32"))] + let cloud_options = match storage_options { + Some(x) => { + let out = >>::try_from(x).map_err(|_| { + RPolarsErr::Other(format!( + "`storage_options` must be a named character vector" + )) + })?; + Some(out.0) + } + None => None, + }; + + #[cfg(target_arch = "wasm32")] + let cloud_options: Option> = None; + + // TODO: Refactor with adding `cloud` feature as like Python Polars + #[cfg(not(target_arch = "wasm32"))] + if let Some(first_path) = first_path { + let first_path_url = first_path.to_string_lossy(); + let cloud_options = + parse_cloud_options(&first_path_url, cloud_options.unwrap_or_default())?; + args.cloud_options = Some(cloud_options.with_max_retries(retries)); } - None => None, - }; - - if let Some(first_path) = first_path { - let first_path_url = first_path.to_string_lossy(); - let cloud_options = - parse_cloud_options(&first_path_url, cloud_options.unwrap_or_default())?; - args.cloud_options = Some(cloud_options.with_max_retries(retries)); - } - let lf = LazyFrame::scan_parquet_files(source.into(), args).map_err(RPolarsErr::from)?; + let lf = + LazyFrame::scan_parquet_files(source.into(), args).map_err(RPolarsErr::from)?; - Ok(lf.into()) + Ok(lf.into()) + } + #[cfg(target_arch = "wasm32")] + { + Err(RPolarsErr::Other(format!("Not supported in WASM")).into()) + } } + #[allow(unused_variables)] fn new_from_ndjson( source: StringSexp, low_memory: bool, @@ -558,90 +597,104 @@ impl PlRLazyFrame { storage_options: Option, file_cache_ttl: Option, ) -> Result { - let source = source - .to_vec() - .iter() - .map(PathBuf::from) - .collect::>(); - let row_index_offset = >::try_from(row_index_offset)?.0; - let infer_schema_length = match infer_schema_length { - Some(x) => Some(>::try_from(x)?.0), - None => None, - }; - let batch_size = match batch_size { - Some(x) => Some(>::try_from(x)?.0), - None => None, - }; - let n_rows = match n_rows { - Some(x) => Some(>::try_from(x)?.0), - None => None, - }; - let file_cache_ttl = match file_cache_ttl { - Some(x) => Some(>::try_from(x)?.0), - None => None, - }; - let retries = >::try_from(retries)?.0; - let schema = match schema { - Some(x) => Some(>::try_from(x)?.0), - None => None, - }; - let schema_overrides = match schema_overrides { - Some(x) => Some(>::try_from(x)?.0), - None => None, - }; - - let row_index = match row_index_name { - Some(x) => Some(RowIndex { - name: x.into(), - offset: row_index_offset, - }), - None => None, - }; - - let first_path = source.first().unwrap().clone().into(); - - let mut r = LazyJsonLineReader::new_paths(source.into()); - - let cloud_options = match storage_options { - Some(x) => { - let out = >>::try_from(x).map_err(|_| { - RPolarsErr::Other(format!( - "`storage_options` must be a named character vector" - )) - })?; - Some(out.0) - } - None => None, - }; - - if let Some(first_path) = first_path { - let first_path_url = first_path.to_string_lossy(); - - let mut cloud_options = - parse_cloud_options(&first_path_url, cloud_options.unwrap_or_default())?; - cloud_options = cloud_options.with_max_retries(retries); - - if let Some(file_cache_ttl) = file_cache_ttl { - cloud_options.file_cache_ttl = file_cache_ttl; - } - - r = r.with_cloud_options(Some(cloud_options)); - }; - - let lf = r - .with_infer_schema_length(infer_schema_length.and_then(NonZeroUsize::new)) - .with_batch_size(batch_size) - .with_n_rows(n_rows) - .low_memory(low_memory) - .with_rechunk(rechunk) - .with_schema(schema.map(|schema| Arc::new(schema))) - .with_schema_overwrite(schema_overrides.map(|x| Arc::new(x))) - .with_row_index(row_index) - .with_ignore_errors(ignore_errors) - .with_include_file_paths(include_file_paths.map(|x| x.into())) - .finish() - .map_err(RPolarsErr::from)?; - - Ok(lf.into()) + #[cfg(not(target_arch = "wasm32"))] + { + let source = source + .to_vec() + .iter() + .map(PathBuf::from) + .collect::>(); + let row_index_offset = >::try_from(row_index_offset)?.0; + let infer_schema_length = match infer_schema_length { + Some(x) => Some(>::try_from(x)?.0), + None => None, + }; + let batch_size = match batch_size { + Some(x) => Some(>::try_from(x)?.0), + None => None, + }; + let n_rows = match n_rows { + Some(x) => Some(>::try_from(x)?.0), + None => None, + }; + let file_cache_ttl = match file_cache_ttl { + Some(x) => Some(>::try_from(x)?.0), + None => None, + }; + let retries = >::try_from(retries)?.0; + let schema = match schema { + Some(x) => Some(>::try_from(x)?.0), + None => None, + }; + let schema_overrides = match schema_overrides { + Some(x) => Some(>::try_from(x)?.0), + None => None, + }; + + let row_index = match row_index_name { + Some(x) => Some(RowIndex { + name: x.into(), + offset: row_index_offset, + }), + None => None, + }; + + let first_path = source.first().unwrap().clone().into(); + + let mut r = LazyJsonLineReader::new_paths(source.into()); + + // TODO: Refactor with adding `cloud` feature as like Python Polars + #[cfg(not(target_arch = "wasm32"))] + let cloud_options = match storage_options { + Some(x) => { + let out = >>::try_from(x).map_err(|_| { + RPolarsErr::Other(format!( + "`storage_options` must be a named character vector" + )) + })?; + Some(out.0) + } + None => None, + }; + + #[cfg(target_arch = "wasm32")] + let cloud_options: Option> = None; + + // TODO: Refactor with adding `cloud` feature as like Python Polars + #[cfg(not(target_arch = "wasm32"))] + if let Some(first_path) = first_path { + let first_path_url = first_path.to_string_lossy(); + + let mut cloud_options = + parse_cloud_options(&first_path_url, cloud_options.unwrap_or_default())?; + cloud_options = cloud_options.with_max_retries(retries); + + if let Some(file_cache_ttl) = file_cache_ttl { + cloud_options.file_cache_ttl = file_cache_ttl; + } + + r = r.with_cloud_options(Some(cloud_options)); + }; + + let lf = r + .with_infer_schema_length(infer_schema_length.and_then(NonZeroUsize::new)) + .with_batch_size(batch_size) + .with_n_rows(n_rows) + .low_memory(low_memory) + .with_rechunk(rechunk) + .with_schema(schema.map(|schema| Arc::new(schema))) + .with_schema_overwrite(schema_overrides.map(|x| Arc::new(x))) + .with_row_index(row_index) + .with_ignore_errors(ignore_errors) + .with_include_file_paths(include_file_paths.map(|x| x.into())) + .finish() + .map_err(RPolarsErr::from)?; + + Ok(lf.into()) + } + #[cfg(target_arch = "wasm32")] + { + Err(RPolarsErr::Other(format!("Not supported in WASM")).into()) + } } }