presto-raptor-legacy/src/main/java/io/prestosql/plugin/raptor/legacy/storage/OrcFileWriter.java/OrcFileWriter/createFileMetadataCallback
class OrcFileWriter:    private static OrcFile.WriterCallback createFileMetadataCallback(List<Long> columnIds, List<Type> columnTypes)
    {
        return new OrcFile.WriterCallback()
        {
            @Override
            public void preStripeWrite(OrcFile.WriterContext context)
            {}

            @Override
            public void preFooterWrite(OrcFile.WriterContext context)
            {
                ImmutableMap.Builder<Long, TypeId> columnTypesMap = ImmutableMap.builder();
                for (int i = 0; i < columnIds.size(); i++) {
                    columnTypesMap.put(columnIds.get(i), columnTypes.get(i).getTypeId());
                }
                byte[] bytes = METADATA_CODEC.toJsonBytes(new OrcFileMetadata(columnTypesMap.build()));
                context.getWriter().addUserMetadata(OrcFileMetadata.KEY, ByteBuffer.wrap(bytes));
            }
        };
    }