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

Using 'null' as ReadJsonOptions.inferSchemaLength produces Error #279

Open
leventea1 opened this issue Sep 30, 2024 · 2 comments
Open

Using 'null' as ReadJsonOptions.inferSchemaLength produces Error #279

leventea1 opened this issue Sep 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@leventea1
Copy link

leventea1 commented Sep 30, 2024

Have you tried latest version of polars?

  • [yes]

What version of polars are you using?

0.15.0

What operating system are you using polars on?

MacOS Sonoma Version 14.4 (23E214)

What node version are you using

node v20.17.0

Describe your bug.

Cannot use null as ReadJsonOptions.inferSchemaLength

What are the steps to reproduce the behavior?

import pl from 'nodejs-polars';
...
pl.readJSON(filePath, { format: "lines", inferSchemaLength: null });

What is the actual behavior?

Currently, setting inferSchemaLength to 'null' throws an error.

<path>/node_modules/nodejs-polars/bin/io.js:139
        return (0, dataframe_1._DataFrame)(method(pathOrBody, options));
                                           ^

Error: Failed to convert napi value Null into rust type `u32` on ReadJsonOptions.inferSchemaLength
    at Object.readJSON (<path>/node_modules/nodejs-polars/bin/io.js:139:44)

What is the expected behavior?

According to docs, it should be working with 'null'
https://github.com/pola-rs/nodejs-polars/blob/main/polars/io.ts#L287

If set to `null`, a full table scan will be done (slow).
@leventea1 leventea1 added the bug Something isn't working label Sep 30, 2024
@Bidek56
Copy link
Collaborator

Bidek56 commented Sep 30, 2024

Have you tried?

import pl from 'nodejs-polars';
pl.readJSON(filePath, { format: "lines" });

@leventea1
Copy link
Author

This works of course:
pl.readJSON(filePath, { format: "lines", inferSchemaLength: 0 });
but still, the documentation is inconsistent with the behavior.

Have you tried?

import pl from 'nodejs-polars';
pl.readJSON(filePath, { format: "lines" });

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

No branches or pull requests

2 participants