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

vector index on clutstered non-int pk table might output empty result #57627

Closed
winoros opened this issue Nov 22, 2024 · 0 comments · Fixed by #57629
Closed

vector index on clutstered non-int pk table might output empty result #57627

winoros opened this issue Nov 22, 2024 · 0 comments · Fixed by #57629
Assignees
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/critical sig/planner SIG: Planner sig/vector type/bug The issue is confirmed as a bug.

Comments

@winoros
Copy link
Member

winoros commented Nov 22, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `chunks_1_backup` (
  `id` char(32) NOT NULL,
  `hash` varchar(64) NOT NULL,
  `text` text DEFAULT NULL,
  `meta` json DEFAULT NULL,
  `embedding` vector(1536) DEFAULT NULL COMMENT 'hnsw(distance=cosine)',
  `document_id` int DEFAULT NULL,
  `relations` json DEFAULT NULL,
  `source_uri` varchar(512) DEFAULT NULL,
  `index_status` enum('NOT_STARTED','PENDING','RUNNING','COMPLETED','FAILED') NOT NULL,
  `index_result` text DEFAULT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `fk_1` (`document_id`),
  KEY `ix_chunks_1_id` (`id`),
  VECTOR INDEX `vec_idx_embedding`((VEC_COSINE_DISTANCE(`embedding`)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin

Insert some data.

Run SQL like select ... from chunks_1_backup order by VEC_COSINE_DISTANCE(embedding, const) limit 10

2. What did you expect to see? (Required)

Should output valid result.

3. What did you see instead (Required)

empty result.

4. What is your TiDB version? (Required)

current master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/critical sig/planner SIG: Planner sig/vector type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant