Class TableStats


  • public class TableStats
    extends java.lang.Object
    This class is a simple wrapper for table-file statistics.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      float avgTupleSize
      The average number of bytes in tuples in this table file.
      private java.util.ArrayList<ColumnStats> columnStats
      This collection holds statistics about individual columns in the table.
      int numDataPages
      The total number of data pages in the table file.
      int numTuples
      The total number of tuples in the table file.
    • Constructor Summary

      Constructors 
      Constructor Description
      TableStats​(int numColumns)
      Create a new table-statistics object with all statistics initialized to zero or NULL values.
      TableStats​(int numDataPages, int numTuples, float avgTupleSize, java.util.ArrayList<ColumnStats> columnStats)
      Create a new table-statistics object with the stats set to the specified values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.ArrayList<ColumnStats> getAllColumnStats()
      Returns the collection of all column-statistics collected for this table.
      ColumnStats getColumnStats​(int index)
      Returns the column-statistics for the specified column.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • numDataPages

        public int numDataPages
        The total number of data pages in the table file. This number is in the range of [0, 216).
      • numTuples

        public int numTuples
        The total number of tuples in the table file. This number is in the range of [0, 231 - 1).
      • avgTupleSize

        public float avgTupleSize
        The average number of bytes in tuples in this table file. This value is a float, and usually includes a fractional part.
      • columnStats

        private java.util.ArrayList<ColumnStats> columnStats
        This collection holds statistics about individual columns in the table.
    • Constructor Detail

      • TableStats

        public TableStats​(int numDataPages,
                          int numTuples,
                          float avgTupleSize,
                          java.util.ArrayList<ColumnStats> columnStats)
        Create a new table-statistics object with the stats set to the specified values. The array of column-statistics objects must have the same number of elements as the table's schema has columns.
        Parameters:
        numDataPages - the number of data pages in the table file
        numTuples - the number of tuples in the table file
        avgTupleSize - the average tuple-size in bytes
        columnStats - an array of column-statistics generated from the table
      • TableStats

        public TableStats​(int numColumns)
        Create a new table-statistics object with all statistics initialized to zero or NULL values.
        Parameters:
        numColumns - the number of columns in the table
    • Method Detail

      • getColumnStats

        public ColumnStats getColumnStats​(int index)
        Returns the column-statistics for the specified column.
        Parameters:
        index - the index of the column to retrieve the stats for
        Returns:
        the column-stats object for the specified column
      • getAllColumnStats

        public java.util.ArrayList<ColumnStats> getAllColumnStats()
        Returns the collection of all column-statistics collected for this table.
        Returns:
        a collection of all column-statistics for the table
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object