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

[JavaScript] Can't create table if it contains an array of strings ("Unable to infer Vector type") #44136

Open
timspro opened this issue Sep 16, 2024 · 2 comments

Comments

@timspro
Copy link

timspro commented Sep 16, 2024

Describe the bug, including details regarding any error messages, version, and platform.

When using tableFromArrays(), I'm seeing the error "Unable to infer Vector type from input values, explicit type declaration expected." for the following code:

  const data = {
    word: [["a"], ["b"]],
  }
  const table = tableFromArrays(data)

For some reason, tableFromArrays() infers the type of each string as a dictionary. Then it compares the IDs of the two dictionaries which are not the same: https://github.com/apache/arrow/blob/main/js/src/visitor/typecomparator.ts#L199.

A more complex example that also produces the error:

  const data = {
    customers: [{names: ["joe"]}, {names: ["bob"]}],
  }
  const table = tableFromArrays(data)

I would prefer not having the type inferred at all and instead explicitly passing a schema or field type as an argument, but I can't seem to find any documentation on how to do that.

Component(s)

JavaScript

@timspro timspro changed the title Can't create table if it contains an array of strings ("Unable to infer Vector type") [JavaScript] Can't create table if it contains an array of strings ("Unable to infer Vector type") Sep 16, 2024
@chrsan
Copy link

chrsan commented Nov 6, 2024

I just stumbled upon this. I can't really wrap my head around why the id is included when using the is operator since a new id is generated in the Dictionary constructor of one isn't explicitly specified.

@timspro
Copy link
Author

timspro commented Nov 6, 2024

I did ultimately figure out a workaround for this using vectorFromArray():

kylebarron/parquet-wasm#606.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants