Skip navigation links
com.splicemachine.db.iapi.store.access

Class RowUtil

    • Field Detail

      • EMPTY_ROW

        public static final DataValueDescriptor[] EMPTY_ROW
        An object that can be used on a fetch to indicate no fields need to be fetched.
      • EMPTY_ROW_BITSET

        public static final FormatableBitSet EMPTY_ROW_BITSET
        An object that can be used on a fetch as a FormatableBitSet to indicate no fields need to be fetched.
    • Method Detail

      • getColumn

        public static DataValueDescriptor getColumn(DataValueDescriptor[] row,
                                                    FormatableBitSet columnList,
                                                    int columnId)
        Get the object for a column identifer (0 based) from a complete or partial row.
        Parameters:
        row - the row
        columnList - valid columns in the row
        columnId - which column to return (0 based)
        Returns:
        the obejct for the column, or null if the column is not represented.
      • getColumn

        public static java.lang.Object getColumn(java.lang.Object[] row,
                                                 FormatableBitSet columnList,
                                                 int columnId)
      • getQualifierBitSet

        public static FormatableBitSet getQualifierBitSet(Qualifier[][] qualifiers)
        Get a FormatableBitSet representing all the columns represented in a qualifier list.
        Returns:
        a FormatableBitSet describing the valid columns.
      • getNumberOfColumns

        public static int getNumberOfColumns(int maxColumnNumber,
                                             FormatableBitSet columnList)
        Get the number of columns represented by a FormatableBitSet.

        This is simply a count of the number of bits set in the FormatableBitSet.

        Parameters:
        maxColumnNumber - Because the FormatableBitSet.size() can't be used as the number of columns, allow caller to tell the maximum column number if it knows. -1 means caller does not know. >=0 number is the largest column number.
        columnList - valid columns in the row
        Returns:
        The number of columns represented in the FormatableBitSet.
      • isRowEmpty

        public static boolean isRowEmpty(DataValueDescriptor[] row)
        See if a row actually contains no columns. Returns true if row is null or row.length is zero.
        Returns:
        true if row is empty.
      • columnOutOfRange

        public static int columnOutOfRange(DataValueDescriptor[] row,
                                           FormatableBitSet columnList,
                                           int maxColumns)
        Return the column number of the first column out of range, or a number less than zero if all columns are in range.
      • nextColumn

        public static int nextColumn(java.lang.Object[] row,
                                     FormatableBitSet columnList,
                                     int startColumn)
        Get the next valid column after or including start column. Returns -1 if no valid columns exist after startColumn
      • newTemplate

        public static DataValueDescriptor[] newTemplate(DataValueFactory dvf,
                                                        FormatableBitSet column_list,
                                                        int[] format_ids,
                                                        int[] collation_ids)
                                                 throws StandardException
        Generate a template row of DataValueDescriptor's

        Generate an array of DataValueDescriptor objects which will be used to make calls to newRowFromClassInfoTemplate(), to repeatedly and efficiently generate new rows. This is important for certain applications like the sorter and fetchSet which generate large numbers of "new" empty rows.

        Parameters:
        column_list - A bit set indicating which columns to include in row.
        format_ids - an array of format id's, one per column in row.
        Returns:
        The new row.
        Throws:
        StandardException - Standard exception policy.
      • newRowFromTemplate

        public static DataValueDescriptor[] newRowFromTemplate(DataValueDescriptor[] template)
                                                        throws StandardException
        Generate an "empty" row from an array of DataValueDescriptor objects.

        Generate an array of new'd objects by using the getNewNull() method on each of the DataValueDescriptor objects.

        Parameters:
        template - An array of DataValueDescriptor objects each of which can be used to create a new instance of the appropriate type to build a new empty template row.
        Returns:
        The new row.
        Throws:
        StandardException - Standard exception policy.
      • toString

        public static java.lang.String toString(java.lang.Object[] row)
        return string version of row.

        For debugging only.

        Parameters:
        row - The row.
        Returns:
        The string version of row.
      • toString

        public static java.lang.String toString(java.util.Hashtable hash_table)
        return string version of a HashTable returned from a FetchSet.

        Returns:
        The string version of row.
      • qualifyRow

        public static final boolean qualifyRow(DataValueDescriptor[] row,
                                               Qualifier[][] qual_list)
                                        throws StandardException
        Process the qualifier list on the row, return true if it qualifies.

        A two dimensional array is to be used to pass around a AND's and OR's in conjunctive normal form. The top slot of the 2 dimensional array is optimized for the more frequent where no OR's are present. The first array slot is always a list of AND's to be treated as described above for single dimensional AND qualifier arrays. The subsequent slots are to be treated as AND'd arrays or OR's. Thus the 2 dimensional array qual[][] argument is to be treated as the following, note if qual.length = 1 then only the first array is valid and it is and an array of and clauses: (qual[0][0] and qual[0][0] ... and qual[0][qual[0].length - 1]) and (qual[1][0] or qual[1][1] ... or qual[1][qual[1].length - 1]) and (qual[2][0] or qual[2][1] ... or qual[2][qual[2].length - 1]) ... and (qual[qual.length - 1][0] or qual[1][1] ... or qual[1][2])

        Parameters:
        row - The row being qualified.
        qual_list - 2 dimensional array representing conjunctive normal form of simple qualifiers.
        Returns:
        true if the row qualifies.
        Throws:
        StandardException - Standard exception policy.