Package microsoft.sql

Class Vector

  • All Implemented Interfaces:
    Serializable

    public final class Vector
    extends Object
    implements Serializable
    Represents a SQL Server VECTOR data type value. A vector stores a fixed-length array of floating-point values, with support for FLOAT32 (32-bit) and FLOAT16 (16-bit half-precision) element types. Example usage: Float[] data = new Float[] { 0.1f, 0.2f, 0.3f }; Vector vector = new Vector(3, VectorDimensionType.FLOAT32, data); pstmt.setObject(1, vector, microsoft.sql.Types.VECTOR);
    Since:
    13.3.2
    See Also:
    Serialized Form
    • Constructor Detail

      • Vector

        public Vector​(int dimensionCount,
                      Vector.VectorDimensionType vectorType,
                      Object[] data)
        Constructor for Vector with dimension count and vector type.
        Parameters:
        dimensionCount - The number of dimensions in the vector.
        vectorType - The type of the vector.
        data - The vector data. Must be Float[] or null.
      • Vector

        public Vector​(int precision,
                      int scale,
                      Object[] data)
        Constructor for Vector with precision and scale value.
        Parameters:
        precision - The number of dimensions in the vector.
        scale - The scale value of the vector (4 for FLOAT32, 2 for FLOAT16).
        data - The vector data. Must be Float[] or null.
    • Method Detail

      • getData

        public Object[] getData()
        Returns the data of the vector.
        Returns:
        The vector data as Float[], or null.
      • getDimensionCount

        public int getDimensionCount()
        Returns the number of dimensions in the vector.
        Returns:
        The dimension count of the vector.
      • getVectorDimensionType

        public Vector.VectorDimensionType getVectorDimensionType()
        Returns the type of the vector.
        Returns:
        The vector dimension type.
      • toString

        public String toString()
        Converts the vector to a string representation.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the vector.