private BitSet getFilteredIndexes(
     DimensionColumnDataChunk dimensionColumnDataChunk, int numerOfRows) {
   byte[] defaultValue = null;
   if (dimColEvaluatorInfoList.get(0).getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
     DirectDictionaryGenerator directDictionaryGenerator =
         DirectDictionaryKeyGeneratorFactory.getDirectDictionaryGenerator(
             dimColEvaluatorInfoList.get(0).getDimension().getDataType());
     int key = directDictionaryGenerator.generateDirectSurrogateKey(null) + 1;
     defaultValue =
         FilterUtil.getMaskKey(
             key,
             dimColEvaluatorInfoList.get(0).getDimension(),
             this.segmentProperties.getDimensionKeyGenerator());
   }
   if (null != dimensionColumnDataChunk.getAttributes().getInvertedIndexes()
       && dimensionColumnDataChunk instanceof FixedLengthDimensionDataChunk) {
     return setFilterdIndexToBitSetWithColumnIndex(
         (FixedLengthDimensionDataChunk) dimensionColumnDataChunk, numerOfRows, defaultValue);
   }
   return setFilterdIndexToBitSet(dimensionColumnDataChunk, numerOfRows, defaultValue);
 }
  @Override
  public BatchResult prepareQueryResult(
      Result<List<ListBasedResultWrapper>, Object> scannedResult) {
    if ((null == scannedResult || scannedResult.size() < 1)) {
      return new BatchRawResult();
    }
    QueryDimension[] queryDimensions = querySchemaInfo.getQueryDimensions();
    int msrSize = queryExecuterProperties.measureDataTypes.length;
    int dimSize = queryDimensions.length;
    int[] order = querySchemaInfo.getQueryReverseOrder();
    Object[][] resultData = new Object[scannedResult.size()][];
    Object[] value;
    Object[] row;
    int counter = 0;
    if (queryModel.isRawBytesDetailQuery()) {
      while (scannedResult.hasNext()) {
        value = scannedResult.getValue();
        row = new Object[msrSize + 1];
        row[0] = scannedResult.getKey();
        if (value != null) {
          assert (value.length == msrSize);
          System.arraycopy(value, 0, row, 1, msrSize);
        }
        resultData[counter] = row;
        counter++;
      }
    } else {
      while (scannedResult.hasNext()) {
        value = scannedResult.getValue();
        row = new Object[msrSize + dimSize];
        ByteArrayWrapper key = scannedResult.getKey();
        if (key != null) {
          long[] surrogateResult =
              querySchemaInfo
                  .getKeyGenerator()
                  .getKeyArray(key.getDictionaryKey(), querySchemaInfo.getMaskedByteIndexes());
          int noDictionaryColumnIndex = 0;
          for (int i = 0; i < dimSize; i++) {
            if (!queryDimensions[i].getDimension().hasEncoding(Encoding.DICTIONARY)) {
              row[order[i]] =
                  DataTypeUtil.getDataBasedOnDataType(
                      new String(key.getNoDictionaryKeyByIndex(noDictionaryColumnIndex++)),
                      queryDimensions[i].getDimension().getDataType());
            } else if (queryDimensions[i].getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
              DirectDictionaryGenerator directDictionaryGenerator =
                  DirectDictionaryKeyGeneratorFactory.getDirectDictionaryGenerator(
                      queryDimensions[i].getDimension().getDataType());
              if (directDictionaryGenerator != null) {
                row[order[i]] =
                    directDictionaryGenerator.getValueFromSurrogate(
                        (int) surrogateResult[queryDimensions[i].getDimension().getKeyOrdinal()]);
              }
            } else {
              row[order[i]] =
                  (int) surrogateResult[queryDimensions[i].getDimension().getKeyOrdinal()];
            }
          }
        }
        for (int i = 0; i < msrSize; i++) {
          row[order[i + queryDimensions.length]] = value[i];
        }
        resultData[counter] = row;
        counter++;
      }
    }

    LOGGER.info("###########################---- Total Number of records" + scannedResult.size());
    BatchRawResult result = new BatchRawResult();
    result.setRows(resultData);
    return result;
  }