void validateAndCompile ( ) { if ( temporal_table_name == null || temporal_table_name . isEmpty ( ) ) { throw new IllegalArgumentException ( "The rollup table cannot be null or empty" ) ; } temporal_table = temporal_table_name . getBytes ( Const . ASCII_CHARSET ) ; if ( groupby_table_name == null || groupby_table_name . isEmpty ( ) ) { throw new IllegalArgumentException ( "The pre-aggregate rollup table cannot" + " be null or empty" ) ; } groupby_table = groupby_table_name . getBytes ( Const . ASCII_CHARSET ) ; if ( units != ' ' && unit_multiplier > 1 ) { throw new IllegalArgumentException ( "Multipliers are only usable with the 'h' unit" ) ; } else if ( units == ' ' && unit_multiplier > 1 && unit_multiplier % 2 != 0 ) { throw new IllegalArgumentException ( "The multiplier must be 1 or an even value" ) ; } interval = ( int ) ( DateTime . parseDuration ( string_interval ) / 1000 ) ; if ( interval < 1 ) { throw new IllegalArgumentException ( "Millisecond intervals are not supported" ) ; } if ( interval >= Integer . MAX_VALUE ) { throw new IllegalArgumentException ( "Interval is too big: " + interval ) ; } // The line above will validate for us interval_units = string_interval . charAt ( string_interval . length ( ) - 1 ) ; int num_span = 0 ; switch ( units ) { case ' ' : num_span = MAX_SECONDS_IN_HOUR ; break ; case ' ' : num_span = MAX_SECONDS_IN_DAY ; break ; case ' ' : num_span = MAX_SECONDS_IN_MONTH ; break ; case ' ' : num_span = MAX_SECONDS_IN_YEAR ; break ; default : throw new IllegalArgumentException ( "Unrecogznied span '" + units + "'" ) ; } num_span *= unit_multiplier ; if ( interval >= num_span ) { throw new IllegalArgumentException ( "Interval [" + interval + "] is too large for the span [" + units + "]" ) ; } intervals = num_span / ( int ) interval ; if ( intervals > MAX_INTERVALS ) { throw new IllegalArgumentException ( "Too many intervals [" + intervals + "] in the span. Must be smaller than [" + MAX_INTERVALS + "] to fit in 14 bits" ) ; } if ( intervals < MIN_INTERVALS ) { throw new IllegalArgumentException ( "Not enough intervals [" + intervals + "] for the span. Must be at least [" + MIN_INTERVALS + "]" ) ; } }
Calculates the number of intervals in a given span for the rollup interval and makes sure we have table names . It also sets the table byte arrays .