private Iterator < Map < String , Object > > queryDataStoreForTableReportResults ( final String reportTable , final AllTablesReportQuery query ) { if ( ! query . getTableNames ( ) . isEmpty ( ) ) { // Querying for a specific set of tables. return Iterators . concat ( Iterators . transform ( query . getTableNames ( ) . iterator ( ) , new Function < String , Map < String , Object > > ( ) { @ Override public Map < String , Object > apply ( String tableName ) { return _dataStore . get ( reportTable , tableName , ReadConsistency . STRONG ) ; } } ) ) ; } // Querying over the full set of tables return new AbstractIterator < Map < String , Object > > ( ) { private String _from = query . getFromTable ( ) ; private Iterator < Map < String , Object > > _batch = Iterators . emptyIterator ( ) ; private long _limit = 0 ; @ Override protected Map < String , Object > computeNext ( ) { if ( ! _batch . hasNext ( ) ) { if ( _limit == 0 ) { // First iteration get the requested number of results _limit = query . getLimit ( ) ; } else { // Subsequent requests iterate over all remaining results; dataStore will batch the results _limit = Long . MAX_VALUE ; } _batch = _dataStore . scan ( reportTable , _from , _limit , false , ReadConsistency . STRONG ) ; if ( ! _batch . hasNext ( ) ) { return endOfData ( ) ; } } Map < String , Object > result = _batch . next ( ) ; _from = Intrinsic . getId ( result ) ; return result ; } } ; }
Returns an iterator of report results based on the query configuration . The results are guaranteed to be a superset of results matching the original query ; further filtering may be required to exactly match the query .