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

Generated Columns deleted the VECTOR index. #8961

Open
coffeegoddd opened this issue Mar 7, 2025 · 1 comment
Open

Generated Columns deleted the VECTOR index. #8961

coffeegoddd opened this issue Mar 7, 2025 · 1 comment
Assignees
Labels
bug Something isn't working sql Issue with SQL vectors

Comments

@coffeegoddd
Copy link
Contributor

Dolt v1.49.3

Public db: https://www.dolthub.com/repositories/dolthub/robot_blogger_v1

After adding and committing generated columns, the diff shows that the existing vector index was deleted somehow:

robot_blogger_v1 % db
  generated-index-bug-gpt-4o-2024-11-20                 
* generated-index-bug-llama3                     
  gpt-4o-2024-11-20                                     
  llama3                                                
  main 
robot_blogger_v1 % dolt diff 0sgd75v8ssbp0fc0qm9lkq1tj7bt5dk5
diff --dolt a/langchain_dolt_embedding b/langchain_dolt_embedding
--- a/langchain_dolt_embedding
+++ b/langchain_dolt_embedding
 CREATE TABLE `langchain_dolt_embedding` (
   `collection_id` varchar(36),
   `embedding` json,
   `document` longtext,
   `cmetadata` json,
   `uuid` varchar(36) NOT NULL,
-  PRIMARY KEY (`uuid`),
-  KEY `langchain_dolt_embedding_collection_id` (`collection_id`),
-  VECTOR KEY `langchain_dolt_embedding_embedding_idx` (`embedding`),
+  `name` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`cmetadata`, '$.name'))),
+  `runner` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`cmetadata`, '$.runner'))),
+  `model` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`cmetadata`, '$.model'))),
+  `md5` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`cmetadata`, '$.md5'))),
+  `doc_source_type` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`cmetadata`, '$.doc_source_type'))),
+  PRIMARY KEY (`uuid`),
   CONSTRAINT `langchain_dolt_embedding_collection_id_fkey` FOREIGN KEY (`collection_id`) REFERENCES `langchain_dolt_collection` (`uuid`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin;
@zachmu
Copy link
Member

zachmu commented Mar 7, 2025

I think @nicktobey may have already fixed this bug, but he should confirm.

@timsehn timsehn added bug Something isn't working sql Issue with SQL vectors labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sql Issue with SQL vectors
Projects
None yet
Development

No branches or pull requests

4 participants