You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered issues while integrating Polars with wasm_bindgen. Through testing various versions of both libraries within the context of my project, I discovered that when implementing the following versions in my cargo.toml file:
This will trigger errors within the internal code of the built crates when attempting to execute the following command:
wasm-pack build --out-dir wasm-build
Ater debugging the code and isolate the problem, i find out that there is some dependencies in polars causing it therefore i changed it to : polars = { version = "0.33.2", default-features = false }
This will make the wasm-pack correctly.
New issues have arisen as a result of these version adjustments. Specifically, I had been using "polars = "0.33.2"" in my code to work with tables. However, in this version ("polars = { version = "0.33.2", default-features = false }"), certain types and implementations, including functions related to Dataframe and Row, have been removed, leading to the occurrence of the following errors:
error[E0432]: unresolved import polars::frame::row
--> src/lib.rs:19:24
|
19 | pub use polars::frame::row::Row;
| ^^^ could not find row in frame
error[E0599]: no method named get_row found for struct polars::prelude::DataFrame in the current scope
--> src/table/table.rs:73:34
|
73 | let row = self.dataframe.get_row(id);
|
Input Code:
This is my following code:
use polars::frame::row::Row;
use polars::prelude::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
#[derive(Debug, Clone)]
pub struct ActionWasm {
date: u64,
num_id: u64,
model_id: Option<u64>,
table_id: Option<u64>,
action_type: ActionTypeWasm,
}
/// there is more code that is using #[wasm_bindgen] to be built by wasm
#[allow(dead_code)]
#[derive(Debug)]
pub struct TableRow<'a> {
row_id: u64,
row_data: Result<Row<'a>, PolarsError>,
}
#[warn(unused_must_use)]
#[derive(Debug, Clone)]
pub struct TableType {
name: String,
id: i32,
dataframe: DataFrame,
metadata: Option<fs::Metadata>,
last_modification: i64,
}
impl TableType {
pub fn new(
name: String,
id: i32,
dataframe: DataFrame,
metadata: Option<fs::Metadata>,
) -> Self {
match dataframe.is_empty() {
true => TableType {
name,
id,
dataframe: DataFrame::empty(),
metadata: None,
last_modification: 0,
},
false => TableType {
name,
id,
dataframe,
metadata,
last_modification: 0,
},
}
}
pub fn get_rows(&self, id: usize) -> TableRow<'_> {
let inode = self.get_metadata().as_ref().expect("REASON").ino();
let row = self.dataframe.get_row(id);
return TableRow {
row_id: inode,
row_data: row,
};
}
Question:
My question revolves around the feasibility of implementing Polars types and functions while ensuring their compatibility with WebAssembly (WASM) to enable the valid execution of the 'wasm-pack' command. Is there a viable solution to achieve this or i will obliged to drop polars and uses another format of data structure ?
This discussion was converted from issue #3661 on October 24, 2023 09:14.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Describe the Bug:
I encountered issues while integrating Polars with wasm_bindgen. Through testing various versions of both libraries within the context of my project, I discovered that when implementing the following versions in my cargo.toml file:
Error:
This will trigger errors within the internal code of the built crates when attempting to execute the following command:
wasm-pack build --out-dir wasm-build
Ater debugging the code and isolate the problem, i find out that there is some dependencies in polars causing it therefore i changed it to :
polars = { version = "0.33.2", default-features = false }
This will make the wasm-pack correctly.
New issues have arisen as a result of these version adjustments. Specifically, I had been using "polars = "0.33.2"" in my code to work with tables. However, in this version ("polars = { version = "0.33.2", default-features = false }"), certain types and implementations, including functions related to Dataframe and Row, have been removed, leading to the occurrence of the following errors:
error[E0432]: unresolved import
polars::frame::row
--> src/lib.rs:19:24
|
19 | pub use polars::frame::row::Row;
| ^^^ could not find
row
inframe
error[E0599]: no method named
get_row
found for structpolars::prelude::DataFrame
in the current scope--> src/table/table.rs:73:34
|
73 | let row = self.dataframe.get_row(id);
|
Input Code:
This is my following code:
Question:
My question revolves around the feasibility of implementing Polars types and functions while ensuring their compatibility with WebAssembly (WASM) to enable the valid execution of the 'wasm-pack' command. Is there a viable solution to achieve this or i will obliged to drop polars and uses another format of data structure ?
Beta Was this translation helpful? Give feedback.
All reactions