Class StatsWriter


  • public class StatsWriter
    extends java.lang.Object
    This class encapsulates the operations of reading and writing table-statistics to a data file.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int COLSTAT_NULLMASK_MAX_VALUE
      A bit-mask used for storing column-stats, to record whether or not the "maximum value" value is present for the column.
      private static int COLSTAT_NULLMASK_MIN_VALUE
      A bit-mask used for storing column-stats, to record whether or not the "minimum value" value is present for the column.
      private static int COLSTAT_NULLMASK_NUM_DISTINCT_VALUES
      A bit-mask used for storing column-stats, to record whether or not the "number of distinct values" value is present for the column.
      private static int COLSTAT_NULLMASK_NUM_NULL_VALUES
      A bit-mask used for storing column-stats, to record whether or not the "number of NULL values" value is present for the column.
      private static org.apache.logging.log4j.Logger logger
      A logging object for reporting anything interesting that happens.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private StatsWriter()  
    • Field Detail

      • logger

        private static org.apache.logging.log4j.Logger logger
        A logging object for reporting anything interesting that happens.
      • COLSTAT_NULLMASK_NUM_DISTINCT_VALUES

        private static final int COLSTAT_NULLMASK_NUM_DISTINCT_VALUES
        A bit-mask used for storing column-stats, to record whether or not the "number of distinct values" value is present for the column.
        See Also:
        Constant Field Values
      • COLSTAT_NULLMASK_NUM_NULL_VALUES

        private static final int COLSTAT_NULLMASK_NUM_NULL_VALUES
        A bit-mask used for storing column-stats, to record whether or not the "number of NULL values" value is present for the column.
        See Also:
        Constant Field Values
      • COLSTAT_NULLMASK_MIN_VALUE

        private static final int COLSTAT_NULLMASK_MIN_VALUE
        A bit-mask used for storing column-stats, to record whether or not the "minimum value" value is present for the column.
        See Also:
        Constant Field Values
      • COLSTAT_NULLMASK_MAX_VALUE

        private static final int COLSTAT_NULLMASK_MAX_VALUE
        A bit-mask used for storing column-stats, to record whether or not the "maximum value" value is present for the column.
        See Also:
        Constant Field Values
    • Constructor Detail

      • StatsWriter

        private StatsWriter()
    • Method Detail

      • writeTableStats

        public static void writeTableStats​(Schema schema,
                                           TableStats stats,
                                           PageWriter pgWriter)
        Writes the specified table-statistics to a data file.
        Parameters:
        schema - the schema of the table
        stats - the statistics to save for the table
        pgWriter - a page-writer specifying where the data should be written to
      • readTableStats

        public static TableStats readTableStats​(PageReader pgReader,
                                                Schema schema)
        Reads the table-statistics from the specified data file.
        Parameters:
        pgReader - a page-reader specifying where the data should be read from
        schema - the schema of the table
        Returns:
        the table statistics loaded from the file