public void merge(List<StorageSegment> segments) throws IOException {
        if (segments.isEmpty()) {
            return;
        }
        long rowCount = this.rowCount();
        for (StorageSegment segment : segments) {
            for (DPColumn column : columns) {
                boolean ok = false;
                for (Object oc : segment.columns) {
                    StorageColumn otherCol = (StorageColumn) oc;
                    if (StringUtils.equals(column.name(), otherCol.name()) && column.dataType() == otherCol.dataType()) {
                        ok = true;
                    }
                }
                if (!ok) {
                    throw new IllegalStateException(String.format("segment with %s cannot merge into %s", segment.schema(), segmentSchema));
                }
            }
            rowCount += segment.rowCount();
        }

        update();

        for (DPColumn column : columns) {
            List<StorageColumn> toMerge = new ArrayList<>(segments.size());
            for (StorageSegment otherSeg : segments) {
                StorageColumn match = null;
                for (Object oc : otherSeg.columns) {
                    StorageColumn otherCol = (StorageColumn) oc;
                    if (StringUtils.equals(column.name(), otherCol.name()) && column.dataType() == otherCol.dataType()) {
                        match = otherCol;
                    }
                }
                toMerge.add(match);
            }
            column.merge(toMerge);
        }
        this.rowCount = rowCount;

        seal();
    }
End up update this Segment. Flush the cache to file and close the open files.
After this call, any ingesting operation will rise exceptions.
indexr-segment/src/main/java/io/indexr/segment/storage/DPSegment.java