private long calculateLimit ( ScanQuery query , Map < String , Object > responseContext ) { if ( query . getOrder ( ) . equals ( ScanQuery . Order . NONE ) ) { return query . getLimit ( ) - ( long ) responseContext . get ( ScanQueryRunnerFactory . CTX_COUNT ) ; } return query . getLimit ( ) ; }
If we re performing time - ordering we want to scan through the first limit rows in each segment ignoring the number of rows already counted on other segments .