Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm compat: bug running polars #19785

Closed
sigmaSd opened this issue Jul 10, 2023 · 6 comments
Closed

npm compat: bug running polars #19785

sigmaSd opened this issue Jul 10, 2023 · 6 comments
Labels
bug Something isn't working correctly node native extension related to the node-api (.node)

Comments

@sigmaSd
Copy link
Contributor

sigmaSd commented Jul 10, 2023

import pl from 'npm:nodejs-polars';
let df = pl.DataFrame({
  integer: [1, 2, 3, 4, 5],
  date: [
    new Date(2022, 1, 1, 0, 0),
    new Date(2022, 1, 2, 0, 0),
    new Date(2022, 1, 3, 0, 0),
    new Date(2022, 1, 4, 0, 0),
    new Date(2022, 1, 5, 0, 0),
  ],
  float: [4.0, 5.0, 6.0, 7.0, 8.0],
});
console.log(df) // error here

error

Error: not found: constructor
    at Object.getColumn (file:///home/mrcool/.cache/deno/npm/registry.npmjs.org/nodejs-polars/0.8.0/bin/dataframe.js:172:46)
    at Object.getOwnPropertyDescriptor (file:///home/mrcool/.cache/deno/npm/registry.npmjs.org/nodejs-polars/0.8.0/bin/dataframe.js:617:31)
    at getOwnPropertyDescriptor (<anonymous>)
    at getConstructorName (ext:deno_console/01_console.js:1205:24)
    at formatRaw (ext:deno_console/01_console.js:810:23)
    at formatValue (ext:deno_console/01_console.js:721:10)
    at Object.inspectArgs (ext:deno_console/01_console.js:3114:28)
    at <anonymous>:3:55 {
  code: "GenericFailure"
}

linux deno 1.35.0

@bartlomieju bartlomieju added bug Something isn't working correctly node native extension related to the node-api (.node) labels Jul 10, 2023
@sigmaSd
Copy link
Contributor Author

sigmaSd commented Aug 19, 2023

The workaround is to use console.log(df.toString());

This will skip deno log machinery for objects

@rgbkrk
Copy link
Contributor

rgbkrk commented Sep 5, 2023

Would it be worth creating a deno package that builds on top of polars in rust directly? Now that #20337 is getting close, I'd love to make sure we can work with tabular data interactively.

@sigmaSd
Copy link
Contributor Author

sigmaSd commented Sep 5, 2023

I personally don't see the benefit, there is a lot of work done in polar-js, and it would be a big duplication of effort for no obvious gain

The polars-js package does work on deno albeit this small issue , one can use the manpower instead to improve the quality if life of deno-polarjs relation, for example making it not use node child process exec somehow since its shells out to sh so you need to give it the permission to run it (though we already need --allow-ffi=pathToLib)

@rgbkrk
Copy link
Contributor

rgbkrk commented Sep 12, 2023

Maybe it would be smart for us to add deno as a test target like in pola-rs/nodejs-polars#115 with a little deno script.

@rgbkrk
Copy link
Contributor

rgbkrk commented Sep 29, 2023

This code runs for me in 1.37.0+

Could you verify too?

@sigmaSd
Copy link
Contributor Author

sigmaSd commented Sep 30, 2023

Thanks it works indeed

@sigmaSd sigmaSd closed this as completed Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node native extension related to the node-api (.node)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants