Skip to content

opengauss vector functionality support #10776

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jzs1997
Copy link

@jzs1997 jzs1997 commented Apr 30, 2025

Description

opengauss also suport vector data type and distance calculation since 7.0.0
Found that the syntax for vector operations in opengauss is similar to pgvector, so reuse the code of pgvector handler to as an approach.

Type of change

(Please delete options that are not relevant)

  • [ x] ⚡ New feature (non-breaking change which adds functionality)

Verification Process

To ensure the changes are working as expected:

  • Test Location: Specify the URL or path for testing.
  • [x ] Verification Steps: Outline the steps or queries needed to validate the change. Include any data, configurations, or actions required to reproduce or see the new functionality.
  • Test Queries:
CREATE DATABASE opengauss_datasource  
WITH ENGINE = 'opengauss',
PARAMETERS = {
  "host": "localhost",                  
  "user": "bot",                  
  "password": "Huawei@123",             
  "port": 8094,               
  "database": "postgres"              
};

DROP DATABASE opengauss_datasource;

-- opengauss_datasource.tv1: a table contains a vector column
-- Create tv1 in opengauss
-- CREATE TABLE tv1(id int, content varchar(255), val vector(3));

SELECT * FROM opengauss_datasource.tv1 LIMIT 5;
SELECT * FROM opengauss_datasource.tv1 where val = '[1,2,3]';
insert into opengauss_datasource.tv1 (id, content, val) values(5, 'abvc', '[2, 3, 4]');
update opengauss_datasource.tv1 set val = '[3,4,5]' where id = 2;
SELECT * FROM opengauss_datasource.tv1 ORDER BY val <-> '[1, 2, 3]' LIMIT 5;
SELECT * FROM opengauss_datasource.tv1 ORDER BY val <#> '[1, 2, 3]' LIMIT 5;
SELECT * FROM opengauss_datasource.tv1 ORDER BY val <=> '[1, 2, 3]' LIMIT 5;
DELETE FROM opengauss_datasource.tv1 WHERE val = '[2, 3, 4]';
CREATE TABLE opengauss_datasource.tv2(select * from opengauss_datasource.tv1);

-- original sql which do not contain vector type
CREATE TABLE opengauss_datasource.items(val int);
INSERT INTO opengauss_datasource.items(val) values(1);
drop table opengauss_datasource.items;

SELECT * FROM opengauss_datasource.items LIMIT 5;
SELECT * FROM opengauss_datasource.items WHERE val < 10;
UPDATE opengauss_datasource.items SET val = 2 WHERE val = 1;
DELETE FROM opengauss_datasource.items WHERE val = 1;

Checklist:

  • My code follows the style guidelines(PEP 8) of MindsDB.
  • I have appropriately commented on my code, especially in complex areas.
  • Necessary documentation updates are either made or tracked in issues.
  • Relevant unit and integration tests are updated or added.

@mindsdbadmin
Copy link
Contributor

mindsdbadmin commented Apr 30, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@jzs1997
Copy link
Author

jzs1997 commented Apr 30, 2025

I have read the CLA Document and I hereby sign the CLA

mindsdbadmin added a commit that referenced this pull request Apr 30, 2025
Copy link
Contributor

@MinuraPunchihewa MinuraPunchihewa left a comment

Choose a reason for hiding this comment

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

Hi @jzs1997,
I believe that this makes it so that the OpenGauss integration can now only be used as a vector store and no longer as a data store? I think it would be best if we can create a separate integration for using it as a vector database instead.

@jzs1997
Copy link
Author

jzs1997 commented May 14, 2025

Hi @jzs1997, I believe that this makes it so that the OpenGauss integration can now only be used as a vector store and no longer as a data store? I think it would be best if we can create a separate integration for using it as a vector database instead.

Hi @MinuraPunchihewa, thank you for your advices, I have some questions about this. I tried some non vector store SQL queries and they still work, could you please elaborate a bit on 'can now only be used as a vector store and no longer as a data store'.

In openGauss, vector store functionality is integrated by default, which means user can use both relational database functions and vector database functions.

Could you please give some hints on 'separate integration', I sort of do not know how to do that.

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.

3 participants