public static StorageSegment addColumn(String name,
                                           StorageSegment baseSegment,
                                           List<UpdateColSchema> newColumnSchema,
                                           Path storePath) throws IOException {
        validateSchema(newColumnSchema);

        List<UpdateColSchema> targetColumns = new ArrayList<>();
        for (ColumnSchema cs : baseSegment.schema().getColumns()) {
            targetColumns.add(new UpdateColSchema(cs.getName(), cs.getSqlType(), cs.isIndexed(), cs.getName()));
        }
        boolean update = false;
        for (UpdateColSchema acs : newColumnSchema) {
            if (indexWhere(targetColumns, c -> c.name.equals(acs.name)) < 0) {
                targetColumns.add(acs);
                update = true;
            }
        }
        if (!update) {
            return baseSegment;
        }
        return newColumnSchema(name, baseSegment, targetColumns, storePath);
    }
Add some new columns to the segment. Those exsiting columns keep unchanged.

@return the new segment. If nothing is changed, returns the original segment instance.
indexr-segment/src/main/java/io/indexr/segment/storage/UpdateColSegment.java