@Override public int aggregateData(AbstractScannedResult scannedResult){
  this.listBasedResult=new ArrayList<>(limit == -1 ? scannedResult.numberOfOutputRows() : limit);
  boolean isMsrsPresent=measureDatatypes.length > 0;
  ByteArrayWrapper wrapper=null;
  ListBasedResultWrapper resultWrapper;
  while (scannedResult.hasNext() && (limit == -1 || rowCounter < limit)) {
    resultWrapper=new ListBasedResultWrapper();
    if (tableBlockExecutionInfos.isDimensionsExistInQuery()) {
      wrapper=new ByteArrayWrapper();
      wrapper.setDictionaryKey(scannedResult.getDictionaryKeyArray());
      wrapper.setNoDictionaryKeys(scannedResult.getNoDictionaryKeyArray());
      wrapper.setComplexTypesKeys(scannedResult.getComplexTypeKeyArray());
      resultWrapper.setKey(wrapper);
    }
 else {
      scannedResult.incrementCounter();
    }
    if (isMsrsPresent) {
      Object[] msrValues=new Object[measureDatatypes.length];
      fillMeasureData(msrValues,scannedResult);
      resultWrapper.setValue(msrValues);
    }
    listBasedResult.add(resultWrapper);
    rowCounter++;
  }
  return rowCounter;
}

@ Override public int aggregateData ( AbstractScannedResult scannedResult ) { this . listBasedResult = new ArrayList < > ( limit == - 1 ? scannedResult . numberOfOutputRows ( ) : limit ) ; boolean isMsrsPresent = measureDatatypes . length > 0 ; ByteArrayWrapper wrapper = null ; ListBasedResultWrapper resultWrapper ; while ( scannedResult . hasNext ( ) && ( limit == - 1 || rowCounter < limit ) ) { resultWrapper = new ListBasedResultWrapper ( ) ; if ( tableBlockExecutionInfos . isDimensionsExistInQuery ( ) ) { wrapper = new ByteArrayWrapper ( ) ; wrapper . setDictionaryKey ( scannedResult . getDictionaryKeyArray ( ) ) ; wrapper . setNoDictionaryKeys ( scannedResult . getNoDictionaryKeyArray ( ) ) ; wrapper . setComplexTypesKeys ( scannedResult . getComplexTypeKeyArray ( ) ) ; resultWrapper . setKey ( wrapper ) ; } else { scannedResult . incrementCounter ( ) ; } if ( isMsrsPresent ) { Object [ ] msrValues = new Object [ measureDatatypes . length ] ; fillMeasureData ( msrValues , scannedResult ) ; resultWrapper . setValue ( msrValues ) ; } listBasedResult . add ( resultWrapper ) ; rowCounter ++ ; } return rowCounter ; }
this method will add a record both key and value to list object it will keep track of how many record is processed , to handle limit scenario
