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

nodejs-polars fails on supported NAPI function #2053

Closed
controversial opened this issue Feb 12, 2023 · 1 comment · Fixed by #2054
Closed

nodejs-polars fails on supported NAPI function #2053

controversial opened this issue Feb 12, 2023 · 1 comment · Fixed by #2054
Labels
bug Something isn't working

Comments

@controversial
Copy link
Contributor

What version of Bun is running?

0.5.6

What platform is your computer?

Darwin 22.3.0 arm64 arm

What steps can reproduce the bug?

The following script attempts to use the nodejs-polars package, which is the official bindings (using napi-rs) to the Polars dataframe library.

The following simple script attempts to create a dataframe:

import pl from 'nodejs-polars';

const df = pl.DataFrame([
  { a: 1, b: 2 },
  { a: 4, b: 10 },
]);
console.log(df);

What is the expected behavior?

Using Node:

❯ node test.js
shape: (2, 2)
┌─────┬──────┐
│ a   ┆ b    │
│ --- ┆ ---  │
│ f64 ┆ f64  │
╞═════╪══════╡
│ 1.0 ┆ 2.0  │
├╌╌╌╌╌┼╌╌╌╌╌╌┤
│ 4.0 ┆ 10.0 │
└─────┴──────┘

What do you see instead?

Using Bun:

❯ bun test.js
125 |                 try {
126 |                     if (localFileExisted) {
127 |                         nativeBinding = require('./nodejs-polars.darwin-arm64.node');
128 |                     }
129 |                     else {
130 |                         nativeBinding = require('nodejs-polars-darwin-arm64');
                            ^
TypeError: dlopen(/Users/luke/Developer/dataset/node_modules/nodejs-polars-darwin-arm64/nodejs-polars.darwin-arm64.node, 0x0001): symbol not found in flat namespace '_napi_fatal_exception'
      at /Users/luke/Developer/dataset/node_modules/nodejs-polars/bin/native-polars.js:130:24
      at /Users/luke/Developer/dataset/node_modules/nodejs-polars/bin/internals/polars_internal.js:6:27
      at /Users/luke/Developer/dataset/node_modules/nodejs-polars/bin/series/series.js:7:26
      at /Users/luke/Developer/dataset/node_modules/nodejs-polars/bin/index.js:24:15
      at /Users/luke/Developer/dataset/test.js:1:0

Additional information

The napi tracking issue says napi_fatal_exception should be supported.

@controversial controversial added the bug Something isn't working label Feb 12, 2023
@ThatOneBro
Copy link
Contributor

I double checked and I think maybe this one may have gotten lost in the weeds. napi_fatal_exception was declared in the node_api.h header, but there was no function definition in napi.cpp, so probably whoever updated the list saw the declaration and thought it was implemented.

I went ahead and attempted an implementation that I need to test and then get feedback on. Gonna link a WIP PR now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants