Skip to content

Support VECTOR data type #1549

Closed
Closed
@bgrainger

Description

@bgrainger

Discussed in #1548, originally posted by @harrison314.

Add support for the VECTOR(n) type, which is available since MariaDB 11.7.

https://mariadb.com/kb/en/vector-overview/

I've solved it with a workaround:

    internal static class MySqlExtensions
    {
        public static MySqlParameter AddWithVectorValue(this MySqlParameterCollection parameters, string name, ReadOnlySpan<float> vector)
        {
            byte[] buffer = new byte[vector.Length * 4];

            for (int i = 0; i < vector.Length; i++)
            {
                BinaryPrimitives.WriteSingleLittleEndian(buffer.AsSpan(i * 4), vector[i]);
            }

            MySqlParameter p = parameters.Add(name, System.Data.DbType.Binary);
            p.Value = buffer;

            return p;
        }
    }
```</div>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions