Package oracle.sql

Interface VECTOR.SparseBooleanArray

  • All Superinterfaces:
    VECTOR.SparseArray
    Enclosing class:
    VECTOR

    public static interface VECTOR.SparseBooleanArray
    extends VECTOR.SparseArray

    A boolean-valued representation of SPARSE VECTOR data in Oracle Database. This interface is optimized for conversions of the BINARY dimension type, but can also be used in conversions of the FLOAT64, FLOAT32, and INT8 types.

    Unlike its sibling SparseArray subclasses, a SparseBooleanArray does not have a values() method. The values of a SparseBooleanArray are implicitly derived from its VECTOR.SparseArray.indices(). All non-zero valued indices have the value of true, and all zero-valued indices have the value of false.

    Since:
    23.9
    • Method Detail

      • of

        static VECTOR.SparseBooleanArray of​(int length,
                                            int[] indices)

        Creates a SparseBooleanArray of the given length and indices. The SparseBooleanArray retains a reference to the array of indices which is passed to this method. After this method returns, changing the values of the array will also change the values retained by the SparseBooleanArray.

        This method will only perform lightweight validations on the input. It will not validate the order or range of values in the indices array. These more extensive validations will occur when the SparseBooleanArray is set as a parameter in SQL executed by Oracle Database.

        Parameters:
        length - Total length of the SparseBooleanArray, including indices with the value of false (zero).
        indices - Indices of true (non-zero) values, ordered from least to greatest, in the range of 0 (inclusive) and the given length(exclusive). Not null.
        Returns:
        A SparseBooleanArray of the given length and indices. Not null.
        Throws:
        java.lang.NullPointerException - If the indices are null.
        java.lang.IllegalArgumentException - If the length is less than 0, or the indices have a length greater than 65535.
      • fromPackedBits

        static VECTOR.SparseBooleanArray fromPackedBits​(byte[] denseArray)
        Creates a SparseBooleanArray that stores only the indices of true (non-zero) bit within a byte array. The bit values are unpacked from each byte in MSB order, such that the byte's highest bit is stored at a lower index within the SparseBooleanArray. The VECTOR.SparseArray.length() of the SparseBooleanArray is the length of the byte[] multiplied by 8.
        Parameters:
        denseArray - Array of bytes, where each bit represents one value: Either a true (one) or false (zero). Not null.
        Returns:
        A sparse array storing only the indices of true (non-zero) values of the dense array. Not null.
        Throws:
        java.lang.NullPointerException - If the denseArray is null.
      • fromDenseArray

        static VECTOR.SparseBooleanArray fromDenseArray​(boolean[] denseArray)
        Creates a SparseBooleanArray that stores only the non-zero (true) values of a boolean array.
        Parameters:
        denseArray - Array of boolean values, including zeros (false). Not null.
        Returns:
        A sparse array storing only the non-zero (true) values of the dense array. Not null.
        Throws:
        java.lang.NullPointerException - If the denseArray is null.