public boolean compatibleWithTable ( VoltTable table ) { String candidateName = getTableName ( table ) ; // table can't have the same name as the view if ( candidateName . equals ( viewName ) ) { return false ; } // view is for a different table if ( candidateName . equals ( srcTableName ) == false ) { return false ; } try { // ignore ret value here - just looking to not throw int groupColIndex = table . getColumnIndex ( groupColName ) ; VoltType groupColType = table . getColumnType ( groupColIndex ) ; if ( groupColType == VoltType . DECIMAL ) { // no longer a good type to group return false ; } // check the sum col is still value int sumColIndex = table . getColumnIndex ( sumColName ) ; VoltType sumColType = table . getColumnType ( sumColIndex ) ; if ( ( sumColType == VoltType . TINYINT ) || ( sumColType == VoltType . SMALLINT ) || ( sumColType == VoltType . INTEGER ) ) { return true ; } else { // no longer a good type to sum return false ; } } catch ( IllegalArgumentException e ) { // column index is bad return false ; } }
Check if the view could apply to the provided table unchanged .