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

[feature][dingo-executor] Support for binary vector indexing #1336

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

githubgxll
Copy link
Contributor

[feature][dingo-executor] Support for binary vector indexing
mysql> select/*+ vector_pre */ * from vector(test, feature, '01010001', 5, map[nprobe, 80]) where id >= 1 order by feature_index$distance limit 6;
+------+------------+----------+------------------------+
| ID | FEATURE_ID | FEATURE | FEATURE_INDEX$DISTANCE |
+------+------------+----------+------------------------+
| 3 | 3 | 01010001 | 0.0 |
| 1 | 1 | 01010101 | 1.0 |
| 2 | 2 | 01010100 | 2.0 |
+------+------------+----------+------------------------+
3 rows in set (0.77 sec)
mysql> select * from vector(test, feature, '01010001', 5, map[nprobe, 80]) order by feature_index$distance limit 6;
+------+------------+----------+------------------------+
| ID | FEATURE_ID | FEATURE | FEATURE_INDEX$DISTANCE |
+------+------------+----------+------------------------+
| 3 | 3 | 01010001 | 0.0 |
| 1 | 1 | 01010101 | 1.0 |
| 2 | 2 | 01010100 | 2.0 |
+------+------------+----------+------------------------+
3 rows in set (0.60 sec)

mysql> select hammingDistance(feature, '01010001') from test;
+--------+
| EXPR$0 |
+--------+
| 1.0 |
| 2.0 |
| 0.0 |
+--------+
3 rows in set (0.17 sec)

mysql> select feature '01010001' from test;
+--------+
| EXPR$0 |
+--------+
| 1.0 |
| 2.0 |
| 0.0 |
+--------+
3 rows in set (0.21 sec)

Copy link
Contributor

@ketor ketor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ketor ketor merged commit 75d37b5 into dingodb:develop Jan 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants