@Test public void testTruncateOperation() throws IOException {

  // delete store path
  deleteStorePath();
  // prepare first dictionary chunk
  // prepare dictionary writer object
  CarbonDictionaryWriterImpl writer = prepareWriter();
  writeDictionaryFile(writer, dataSet1);
  long endOffsetAfterFirstDictionaryChunk = CarbonUtil.getFileSize(dictionaryFilePath);
  // maintain the offset till end offset of first chunk
  writer = prepareWriter();
  writeDictionaryFile(writer, dataSet2);
  // prepare first column meta chunk object
  ColumnDictionaryChunkMeta firstDictionaryChunkMeta =
      new ColumnDictionaryChunkMeta(1, 2, 0, endOffsetAfterFirstDictionaryChunk, 1);
  // overwrite the dictionary meta chunk file to test the truncate operation
  overwriteDictionaryMetaFile(firstDictionaryChunkMeta, dictionaryMetaFilePath);
  writer = prepareWriter();
  // in the next step truncate operation will be tested while writing dictionary file
  writeDictionaryFile(writer, dataSet3);
  // read dictionary file
  List<byte[]> dictionaryValues = readDictionaryFile(0L, 0L);
  List<String> actual = convertByteArrayListToStringValueList(dictionaryValues);
  List<String> expected = new ArrayList<>(4);
  expected.addAll(dataSet1);
  expected.addAll(dataSet3);
  // validate the data retrieved and it should match dataset1
  compareDictionaryData(actual, expected);
}