Search in sources :

Example 1 with NullMemoryManager

use of org.apache.orc.NullMemoryManager in project presto by prestodb.

the class TestOrcReaderPositions method createFileWithOnlyUserMetadata.

private static void createFileWithOnlyUserMetadata(File file, Map<String, String> metadata) throws IOException {
    Configuration conf = new Configuration();
    OrcFile.WriterOptions writerOptions = OrcFile.writerOptions(conf).memory(new NullMemoryManager()).inspector(createSettableStructObjectInspector("test", BIGINT)).compress(SNAPPY);
    Writer writer = OrcFile.createWriter(new Path(file.toURI()), writerOptions);
    for (Map.Entry<String, String> entry : metadata.entrySet()) {
        writer.addUserMetadata(entry.getKey(), ByteBuffer.wrap(entry.getValue().getBytes(UTF_8)));
    }
    writer.close();
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) OrcFile(org.apache.hadoop.hive.ql.io.orc.OrcFile) NullMemoryManager(org.apache.orc.NullMemoryManager) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Writer(org.apache.hadoop.hive.ql.io.orc.Writer) OrcTester.createOrcRecordWriter(com.facebook.presto.orc.OrcTester.createOrcRecordWriter)

Aggregations

OrcTester.createOrcRecordWriter (com.facebook.presto.orc.OrcTester.createOrcRecordWriter)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Map (java.util.Map)1 Configuration (org.apache.hadoop.conf.Configuration)1 Path (org.apache.hadoop.fs.Path)1 OrcFile (org.apache.hadoop.hive.ql.io.orc.OrcFile)1 Writer (org.apache.hadoop.hive.ql.io.orc.Writer)1 NullMemoryManager (org.apache.orc.NullMemoryManager)1