fix(node): support Apache Arrow through version 21

This commit is contained in:
Vincent Koc
2026-10-01 11:01:24 -05:00
committed by Dan Tasse
parent 857e455361
commit 8dfd371031
5 changed files with 145 additions and 10 deletions
+16 -3
View File
@@ -6,6 +6,9 @@ import * as arrow15 from "apache-arrow-15";
import * as arrow16 from "apache-arrow-16";
import * as arrow17 from "apache-arrow-17";
import * as arrow18 from "apache-arrow-18";
import * as arrow19 from "apache-arrow-19";
import * as arrow20 from "apache-arrow-20";
import * as arrow21 from "apache-arrow-21";
import {
Field as CurrentField,
@@ -110,16 +113,26 @@ it("preserves field metadata from a provided schema", async function () {
expect(roundTripped.schema.fields[0].metadata).toEqual(jsonMetadata);
});
describe.each([arrow15, arrow16, arrow17, arrow18])(
describe.each([arrow15, arrow16, arrow17, arrow18, arrow19, arrow20, arrow21])(
"Arrow",
(
arrow: typeof arrow15 | typeof arrow16 | typeof arrow17 | typeof arrow18,
arrow:
| typeof arrow15
| typeof arrow16
| typeof arrow17
| typeof arrow18
| typeof arrow19
| typeof arrow20
| typeof arrow21,
) => {
type ApacheArrow =
| typeof arrow15
| typeof arrow16
| typeof arrow17
| typeof arrow18;
| typeof arrow18
| typeof arrow19
| typeof arrow20
| typeof arrow21;
const {
Schema,
Field,
+15 -2
View File
@@ -7,6 +7,9 @@ import * as arrow15 from "apache-arrow-15";
import * as arrow16 from "apache-arrow-16";
import * as arrow17 from "apache-arrow-17";
import * as arrow18 from "apache-arrow-18";
import * as arrow19 from "apache-arrow-19";
import * as arrow20 from "apache-arrow-20";
import * as arrow21 from "apache-arrow-21";
import * as tmp from "tmp";
@@ -18,7 +21,17 @@ import {
} from "../lancedb/embedding";
import { getRegistry, register } from "../lancedb/embedding/registry";
describe.each([arrow15, arrow16, arrow17, arrow18])("LanceSchema", (arrow) => {
const arrowVersions = [
arrow15,
arrow16,
arrow17,
arrow18,
arrow19,
arrow20,
arrow21,
];
describe.each(arrowVersions)("LanceSchema", (arrow) => {
test("should preserve input order", async () => {
const schema = LanceSchema({
id: new arrow.Int32(),
@@ -29,7 +42,7 @@ describe.each([arrow15, arrow16, arrow17, arrow18])("LanceSchema", (arrow) => {
});
});
describe.each([arrow15, arrow16, arrow17, arrow18])("Registry", (arrow) => {
describe.each(arrowVersions)("Registry", (arrow) => {
let tmpDir: tmp.DirResult;
beforeEach(() => {
tmpDir = tmp.dirSync({ unsafeCleanup: true });
+9 -3
View File
@@ -11,6 +11,9 @@ import * as arrow15 from "apache-arrow-15";
import * as arrow16 from "apache-arrow-16";
import * as arrow17 from "apache-arrow-17";
import * as arrow18 from "apache-arrow-18";
import * as arrow19 from "apache-arrow-19";
import * as arrow20 from "apache-arrow-20";
import * as arrow21 from "apache-arrow-21";
import {
AutoQuery,
@@ -57,7 +60,7 @@ import {
} from "../lancedb/query";
import { LocalTable } from "../lancedb/table";
describe.each([arrow15, arrow16, arrow17, arrow18])(
describe.each([arrow15, arrow16, arrow17, arrow18, arrow19, arrow20, arrow21])(
"Given a table",
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
(arrow: any) => {
@@ -68,7 +71,10 @@ describe.each([arrow15, arrow16, arrow17, arrow18])(
| import("apache-arrow-15").Schema
| import("apache-arrow-16").Schema
| import("apache-arrow-17").Schema
| import("apache-arrow-18").Schema = new arrow.Schema([
| import("apache-arrow-18").Schema
| import("apache-arrow-19").Schema
| import("apache-arrow-20").Schema
| import("apache-arrow-21").Schema = new arrow.Schema([
new arrow.Field("id", new arrow.Float64(), true),
]);
@@ -3203,7 +3209,7 @@ it("passes cleanupOlderThan to the native binding as an absolute timestamp", asy
expect(optimize).toHaveBeenCalledWith(cutoff.getTime(), true);
});
describe.each([arrow15, arrow16, arrow17, arrow18])(
describe.each([arrow15, arrow16, arrow17, arrow18, arrow19, arrow20, arrow21])(
"when optimizing a dataset",
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
(arrow: any) => {