private int getMaxRowCount ( Session session , int rowCount ) { int limitStart = getLimitStart ( session ) ; int limitCount = getLimitCount ( session , rowCount ) ; if ( simpleLimit ) { if ( rowCount == 0 ) { rowCount = limitCount ; } // A VoltDB extension to support LIMIT 0 if ( rowCount > Integer . MAX_VALUE - limitStart ) { /* disable 1 line ... if (rowCount == 0 || rowCount > Integer.MAX_VALUE - limitStart) { ... disabled 1 line */ // End of VoltDB extension rowCount = Integer . MAX_VALUE ; } else { rowCount += limitStart ; } } else { rowCount = Integer . MAX_VALUE ; // A VoltDB extension to support LIMIT 0 // limitCount == 0 can be enforced/optimized as rowCount == 0 regardless of offset // even in non-simpleLimit cases (SELECT DISTINCT, GROUP BY, and/or ORDER BY). // This is an optimal handling of a hard-coded LIMIT 0, but it really shouldn't be the ONLY // enforcement for zero LIMITs -- what about "LIMIT ?" with 0 passed later as a parameter? // The HSQL executor ("HSQL back end") also needs runtime enforcement of zero limits. // The VoltDB executor has such enforcement. if ( limitCount == 0 ) { rowCount = 0 ; } // End of VoltDB extension } return rowCount ; }
translate the rowCount into total number of rows needed from query including any rows skipped at the beginning