@lancedb/lancedb 0.20.1-beta.1 → 0.20.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/arrow.js +18 -2
  2. package/package.json +9 -9
package/dist/arrow.js CHANGED
@@ -682,8 +682,14 @@ async function applyEmbeddingsFromMetadata(table, schema) {
682
682
  if (sourceColumn === undefined) {
683
683
  throw new Error(`Cannot apply embedding function because the source column '${functionEntry.sourceColumn}' was not present in the data`);
684
684
  }
685
+ // Check if destination column exists and handle accordingly
685
686
  if (columns[destColumn] !== undefined) {
686
- throw new Error(`Attempt to apply embeddings to table failed because column ${destColumn} already existed`);
687
+ const existingColumn = columns[destColumn];
688
+ // If the column exists but is all null, we can fill it with embeddings
689
+ if (existingColumn.nullCount !== existingColumn.length) {
690
+ // Column has non-null values, skip embedding application
691
+ continue;
692
+ }
687
693
  }
688
694
  if (table.batches.length > 1) {
689
695
  throw new Error("Internal error: `makeArrowTable` unexpectedly created a table with more than one batch");
@@ -765,8 +771,18 @@ async function applyEmbeddings(table, embeddings, schema) {
765
771
  }
766
772
  }
767
773
  else {
774
+ // Check if destination column exists and handle accordingly
768
775
  if (Object.prototype.hasOwnProperty.call(newColumns, destColumn)) {
769
- throw new Error(`Attempt to apply embeddings to table failed because column ${destColumn} already existed`);
776
+ const existingColumn = newColumns[destColumn];
777
+ // If the column exists but is all null, we can fill it with embeddings
778
+ if (existingColumn.nullCount !== existingColumn.length) {
779
+ // Column has non-null values, skip embedding application and return table as-is
780
+ let newTable = new apache_arrow_1.Table(newColumns);
781
+ if (schema != null) {
782
+ newTable = alignTable(newTable, schema);
783
+ }
784
+ return new apache_arrow_1.Table(new apache_arrow_1.Schema(newTable.schema.fields, schemaMetadata), newTable.batches);
785
+ }
770
786
  }
771
787
  if (table.batches.length > 1) {
772
788
  throw new Error("Internal error: `makeArrowTable` unexpectedly created a table with more than one batch");
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "ann"
12
12
  ],
13
13
  "private": false,
14
- "version": "0.20.1-beta.1",
14
+ "version": "0.20.1-beta.2",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -100,14 +100,14 @@
100
100
  "reflect-metadata": "^0.2.2"
101
101
  },
102
102
  "optionalDependencies": {
103
- "@lancedb/lancedb-darwin-x64": "0.20.1-beta.1",
104
- "@lancedb/lancedb-darwin-arm64": "0.20.1-beta.1",
105
- "@lancedb/lancedb-linux-x64-gnu": "0.20.1-beta.1",
106
- "@lancedb/lancedb-linux-arm64-gnu": "0.20.1-beta.1",
107
- "@lancedb/lancedb-linux-x64-musl": "0.20.1-beta.1",
108
- "@lancedb/lancedb-linux-arm64-musl": "0.20.1-beta.1",
109
- "@lancedb/lancedb-win32-x64-msvc": "0.20.1-beta.1",
110
- "@lancedb/lancedb-win32-arm64-msvc": "0.20.1-beta.1"
103
+ "@lancedb/lancedb-darwin-x64": "0.20.1-beta.2",
104
+ "@lancedb/lancedb-darwin-arm64": "0.20.1-beta.2",
105
+ "@lancedb/lancedb-linux-x64-gnu": "0.20.1-beta.2",
106
+ "@lancedb/lancedb-linux-arm64-gnu": "0.20.1-beta.2",
107
+ "@lancedb/lancedb-linux-x64-musl": "0.20.1-beta.2",
108
+ "@lancedb/lancedb-linux-arm64-musl": "0.20.1-beta.2",
109
+ "@lancedb/lancedb-win32-x64-msvc": "0.20.1-beta.2",
110
+ "@lancedb/lancedb-win32-arm64-msvc": "0.20.1-beta.2"
111
111
  },
112
112
  "peerDependencies": {
113
113
  "apache-arrow": ">=15.0.0 <=18.1.0"