mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-13 14:16:54 +00:00
test(nodejs): cover camelCase column names across table surfaces
References #3211. The core `col()` camelCase integration coverage requested by #3211 is already on `main` from #4493. This PR adds the adjacent raw-SQL table-surface regressions that were previously uncovered: - unquoted `where("camelCase = 1")` - `update` and `delete` with unquoted camelCase predicates - `mergeInsert` with a camelCase join key, including matched-update and not-matched-insert input - `addColumns` `valueSql` referencing a camelCase column - `createIndex` on a camelCase column These are characterization tests for the existing local-backend behavior. They do not add `col()` coverage or require a live remote service.
This commit is contained in:
@@ -4973,6 +4973,44 @@ describe("column name options", () => {
|
||||
expect(results[0].camelCase).toBe(1);
|
||||
});
|
||||
|
||||
test("can filter on an unquoted camelCase column", async () => {
|
||||
const results = await table.query().where("camelCase = 1").toArray();
|
||||
expect(results[0].camelCase).toBe(1);
|
||||
});
|
||||
|
||||
test("can update and delete by camelCase column", async () => {
|
||||
await table.update({ where: "camelCase = 1", values: { camelCase: 2 } });
|
||||
expect(await table.query().where("camelCase = 2").toArray()).toHaveLength(
|
||||
1,
|
||||
);
|
||||
await table.delete("camelCase = 2");
|
||||
expect(await table.countRows()).toBe(0);
|
||||
});
|
||||
|
||||
test("can mergeInsert on a camelCase join key", async () => {
|
||||
await table
|
||||
.mergeInsert("camelCase")
|
||||
.whenMatchedUpdateAll()
|
||||
.whenNotMatchedInsertAll()
|
||||
.execute([
|
||||
{ camelCase: 1, vector: [0.3, 0.4] },
|
||||
{ camelCase: 5, vector: [0.5, 0.6] },
|
||||
]);
|
||||
expect(await table.countRows()).toBe(2);
|
||||
const inserted = await table.query().where("camelCase = 5").toArray();
|
||||
expect(inserted).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("can reference a camelCase column in addColumns sql", async () => {
|
||||
await table.addColumns([{ name: "doubled", valueSql: "camelCase * 2" }]);
|
||||
const results = await table.query().select(["doubled"]).toArray();
|
||||
expect(results[0].doubled).toBe(2);
|
||||
});
|
||||
|
||||
test("can createIndex on a camelCase column", async () => {
|
||||
await table.createIndex("camelCase");
|
||||
});
|
||||
|
||||
test("can make multiple vector queries in one go", async () => {
|
||||
const results = await table
|
||||
.query()
|
||||
|
||||
Reference in New Issue
Block a user