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

Support VECTOR data type #1551

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Support VECTOR data type #1551

wants to merge 13 commits into from

Conversation

bgrainger
Copy link
Member

@bgrainger bgrainger commented Feb 23, 2025

Related to #1549


For more details, open the Copilot Workspace session.

Signed-off-by: Bradley Grainger <[email protected]>
Signed-off-by: Bradley Grainger <[email protected]>
Signed-off-by: Bradley Grainger <[email protected]>
Signed-off-by: Bradley Grainger <[email protected]>
Signed-off-by: Bradley Grainger <[email protected]>
Signed-off-by: Bradley Grainger <[email protected]>
MySql.Data 8.4.0 already supports the VECTOR data type.

Signed-off-by: Bradley Grainger <[email protected]>
Signed-off-by: Bradley Grainger <[email protected]>
Signed-off-by: Bradley Grainger <[email protected]>
@bgrainger bgrainger requested a review from Copilot March 8, 2025 20:36
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR adds support for a new VECTOR data type in the connector, including the implementation of a dedicated column reader, updates to type mapping and parameter handling, and tests and pipeline adjustments.

  • New VectorColumnReader implementation returning a float array from raw data
  • Updated type mapping and parameter handling to correctly recognize and convert VECTOR data
  • Integration tests and CI pipeline configuration updated to exercise and validate VECTOR behavior

Reviewed Changes

File Description
src/MySqlConnector/ColumnReaders/VectorColumnReader.cs Introduces a new column reader that converts binary data to a float array for VECTOR columns.
tests/IntegrationTests/DataTypes.cs Adds test cases for VECTOR data and adjusts schema validation for VECTOR columns.
src/MySqlConnector/Core/SingleCommandPayloadCreator.cs Adjusts parameter creation to treat VECTOR as LongBlob for MariaDB.
src/MySqlConnector/MySqlDbColumn.cs Updates column size calculation for VECTOR types.
src/MySqlConnector/Core/TypeMapper.cs Adds a new DbType mapping and column type metadata for VECTOR, including conversion from DbType to MySqlDbType.
src/MySqlConnector/MySqlParameter.cs Extends SQL string and binary parameter handling to support float[] values for VECTOR.
src/MySqlConnector/MySqlDataReader.cs Modifies output parameter conversion to accommodate the VECTOR type.
src/MySqlConnector/Protocol/ColumnType.cs Adds the VECTOR enum value to the ColumnType declaration.
src/MySqlConnector/ColumnReaders/ColumnReader.cs Dispatches VECTOR columns to the new VectorColumnReader.
src/MySqlConnector/MySqlDbType.cs Extends the MySqlDbType enum with a VECTOR value.
azure-pipelines.yml Updates unsupported features lists to include VECTOR where necessary.
docs/content/home.md Revises compatibility information to reflect new MariaDB versions supporting VECTOR.
tests/IntegrationTests/CharacterSetTests.cs Updates collation check to account for new MariaDB version naming.
src/MySqlConnector/Core/Row.cs Adjusts binary data conversion rules to allow VECTOR type along with Geometry.

Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/MySqlConnector/ColumnReaders/VectorColumnReader.cs:11

  • Consider adding a validation check to ensure that the length of 'data' is a multiple of 4 bytes before performing the cast, to prevent potential runtime exceptions.
MemoryMarshal.Cast<byte, float>(data).ToArray();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant