mirror of
https://github.com/lancedb/lancedb.git
synced 2026-08-18 12:08:35 +00:00
test(node): cover fixed-size list schemas with typed arrays (#3866)
## Summary - cover explicit FixedSizeList schemas populated from Float32Array values - verify the original vector.0 failure stays fixed across Arrow 15, 16, 17, and 18 ## Root cause and fix In v0.16, schema subset inference treated typed-array vectors as nested objects and looked up numeric paths such as vector.0, which do not exist in a FixedSizeList schema. Current typed-array handling correctly recognizes ArrayBuffer views as vector values instead of traversing their elements. This change adds the missing regression coverage for the reported explicit-schema path so that behavior cannot regress unnoticed. ## Validation - pnpm test __test__/arrow.test.ts --runInBand - pnpm lint - pnpm build - pnpm run docs - pnpm test --runInBand (681 passed, 5 skipped) Fixes #2134 <!-- lance-gatekeeper-fix:v1 agent=1d548cb70f6df110ce0a5b119395b52a generation=1 --> Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
798e5364fb
commit
03b52e5877
@@ -197,6 +197,35 @@ describe.each([arrow15, arrow16, arrow17, arrow18])(
|
||||
expect(table.getChild("d")?.toJSON()).toEqual([9n, 10n, null]);
|
||||
});
|
||||
|
||||
it("will use a provided FixedSizeList schema with typed array values", function () {
|
||||
const schema = new Schema([
|
||||
new Field("text", new Utf8(), false),
|
||||
new Field(
|
||||
"vector",
|
||||
new FixedSizeList(3, new Field("item", new Float32(), false)),
|
||||
false,
|
||||
),
|
||||
]);
|
||||
|
||||
const table = makeArrowTable(
|
||||
[
|
||||
{
|
||||
text: "foo",
|
||||
vector: new Float32Array([1, 2, 3]),
|
||||
},
|
||||
],
|
||||
{ schema },
|
||||
);
|
||||
|
||||
expect(table.getChild("text")?.toJSON()).toEqual(["foo"]);
|
||||
expect(
|
||||
table
|
||||
.getChild("vector")
|
||||
?.toJSON()
|
||||
.map((value) => value.toJSON()),
|
||||
).toEqual([[1, 2, 3]]);
|
||||
});
|
||||
|
||||
it("will assume the column `vector` is FixedSizeList<Float32> by default", async function () {
|
||||
const schema = new Schema([
|
||||
new Field("a", new Float(Precision.DOUBLE), true),
|
||||
|
||||
Reference in New Issue
Block a user