public void merge(byte dataType, DictStruct[] structs) throws IOException {
        // Initialize.
        entryBuffer.clear();
        entryOffsetBuffer.clear();
        bitmapBuffer.clear();
        strEntryLastOffset = 0;

        DirectBitMap bitmap = new DirectBitMap(structs.length);

        try {
            entryFilePath = dir.resolve("entry");
            entryFile = FileChannel.open(
                    entryFilePath,
                    StandardOpenOption.WRITE,
                    StandardOpenOption.CREATE,
                    StandardOpenOption.TRUNCATE_EXISTING);

            bitmapFilePath = dir.resolve("bitmap");
            bitmapFile = FileChannel.open(
                    bitmapFilePath,
                    StandardOpenOption.WRITE,
                    StandardOpenOption.READ,
                    StandardOpenOption.CREATE,
                    StandardOpenOption.TRUNCATE_EXISTING);

            if (dataType != ColumnType.STRING) {
                entryOffsetFilePath = null;
                entryOffsetFile = null;
            } else {
                entryOffsetFilePath = dir.resolve("entry_offset");
                entryOffsetFile = FileChannel.open(
                        entryOffsetFilePath,
                        StandardOpenOption.WRITE,
                        StandardOpenOption.CREATE,
                        StandardOpenOption.TRUNCATE_EXISTING);
            }

            switch (dataType) {
                case ColumnType.INT:
                    mergeInts(structs, bitmap);
                    break;
                case ColumnType.LONG:
                    mergeLongs(structs, bitmap);
                    break;
                case ColumnType.FLOAT:
                    mergeFloats(structs, bitmap);
                    break;
                case ColumnType.DOUBLE:
                    mergeDoubles(structs, bitmap);
                    break;
                case ColumnType.STRING:
                    mergeStrings(structs, bitmap);
                    break;
                default:
                    throw new IllegalStateException("Illegal dataType: " + dataType);
            }

            if (entryCount >= BITMAP_MERGE_SLOT << 1) {
                // Sotre merge bitmaps.
                bitmapMergeSlotCount = BITMAP_MERGE_SLOT;

                ByteBufferReader bitmapFileReader = ByteBufferReader.of(bitmapFile, 0, null);
                ByteBufferWriter mergeBitmapWriter = ByteBufferWriter.of(bitmapFile, bitmapFile.size(), null);

                MergeBitMapUtil.mergeBitMaps(
                        bitmapFileReader,
                        mergeBitmapWriter,
                        structs.length,
                        entryCount,
                        bitmapMergeSlotCount);
            } else {
                bitmapMergeSlotCount = 0;
            }

            entryFileSize = entryFile.size();
            entryOffsetFileSize = entryOffsetFile == null ? 0 : entryOffsetFile.size();
            bitmapFileSize = bitmapFile.size();
        } finally {
            if (entryFile != null) {
                Try.on(() -> entryFile.force(false), logger);
                IOUtil.closeQuietly(entryFile);
                entryFile = null;
            }
            if (entryOffsetFile != null) {
                Try.on(() -> entryOffsetFile.force(false), logger);
                IOUtil.closeQuietly(entryOffsetFile);
                entryOffsetFile = null;
            }
            if (bitmapFile != null) {
                Try.on(() -> bitmapFile.force(false), logger);
                IOUtil.closeQuietly(bitmapFile);
                bitmapFile = null;
            }

            bitmap.free();
        }
    }
Delete all files generated by this class.
indexr-vlt-segment/src/main/java/io/indexr/vlt/segment/index/DictMerge.java