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

[JS] vectorFromArray fails with FixedSizeList #45453

Closed
wjones127 opened this issue Feb 6, 2025 · 2 comments
Closed

[JS] vectorFromArray fails with FixedSizeList #45453

wjones127 opened this issue Feb 6, 2025 · 2 comments

Comments

@wjones127
Copy link
Member

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

> let { vectorFromArray, FixedSizeList, Float32 } = require('apache-arrow');
undefined

vectorFromArray works for float arrays:

> vectorFromArray([1, 2, 3], new Float32());
Vector [FloatVector<Float>] {
  isValid: [Function (anonymous)],
  get: [Function (anonymous)],
  set: [Function (anonymous)],
  indexOf: [Function (anonymous)],
  _offsets: [ 0, 3 ],
  data: [
    Data {
      type: [Float32 [Float]],
      children: [],
      dictionary: undefined,
      offset: 0,
      length: 3,
      _nullCount: 0,
      stride: 1,
      values: [Float32Array],
      nullBitmap: Uint8Array(0) []
    }
  ],
  type: Float32 [Float] { typeId: 3, precision: 1 },
  stride: 1,
  numChildren: 0,
  length: 3
}

But fails for fixed size list array:

> const type = new FixedSizeList(3, new Float32());
undefined
> vectorFromArray([[1, 2, 3], [4, 5, 6]], type)
Uncaught Error: Unrecognized type 'NONE'
    at getVisitFnByTypeId (/Users/willjones/Documents/lancedb/nodejs/node_modules/apache-arrow/visitor.js:233:11)
    at getVisitFn (/Users/willjones/Documents/lancedb/nodejs/node_modules/apache-arrow/visitor.js:72:12)
    at GetBuilderCtor.getVisitFn (/Users/willjones/Documents/lancedb/nodejs/node_modules/apache-arrow/visitor.js:30:16)
    at makeBuilder (/Users/willjones/Documents/lancedb/nodejs/node_modules/apache-arrow/factories.js:31:52)
    at makeBuilder (/Users/willjones/Documents/lancedb/nodejs/node_modules/apache-arrow/factories.js:41:35)
    at /Users/willjones/Documents/lancedb/nodejs/node_modules/apache-arrow/factories.js:181:25
    at Generator.next (<anonymous>)
    at vectorFromArray (/Users/willjones/Documents/lancedb/nodejs/node_modules/apache-arrow/factories.js:52:55)

Component(s)

JavaScript

@raulcd
Copy link
Member

raulcd commented Feb 7, 2025

@wjones127 wasn't this an issue in the end? Just wondering in case someone is having the same issue in the future and sees it closed without any context.

@wjones127
Copy link
Member Author

I found the issue was that I passed a type new Float32() into new FixedSizeList() when I should have passed a field.

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