public class PhysicalFsWriter extends Object implements PhysicalWriter
Modifier and Type | Class and Description |
---|---|
protected static class |
PhysicalFsWriter.VariantTracker
Record the information about each column encryption variant.
|
PhysicalWriter.OutputReceiver
Constructor and Description |
---|
PhysicalFsWriter(FileSystem fs,
Path path,
OrcFile.WriterOptions opts) |
PhysicalFsWriter(FileSystem fs,
Path path,
OrcFile.WriterOptions opts,
WriterEncryptionVariant[] encryption) |
PhysicalFsWriter(FSDataOutputStream outputStream,
OrcFile.WriterOptions opts,
WriterEncryptionVariant[] encryption) |
Modifier and Type | Method and Description |
---|---|
void |
appendRawStripe(ByteBuffer buffer,
OrcProto.StripeInformation.Builder dirEntry)
Appends raw stripe data (e.g.
|
void |
close()
Closes the writer.
|
org.apache.orc.impl.PhysicalFsWriter.BufferedStream |
createDataStream(StreamName name)
Create an OutputReceiver for the given name.
|
protected OutputStream |
createIndexStream(StreamName name) |
void |
finalizeStripe(OrcProto.StripeFooter.Builder footerBuilder,
OrcProto.StripeInformation.Builder dirEntry)
Flushes the data in all the streams, spills them to disk, write out stripe
footer.
|
void |
flush()
Flushes the writer so that readers can see the preceding postscripts.
|
long |
getFileBytes(int column,
WriterEncryptionVariant variant)
Get the number of bytes for a file in a given column
by finding all the streams (not suppressed)
for a given column and returning the sum of their sizes.
|
StreamOptions |
getStreamOptions()
Get the unencrypted stream options for this file.
|
String |
toString() |
void |
writeBloomFilter(StreamName name,
OrcProto.BloomFilterIndex.Builder bloom)
Write a bloom filter index in the given stream name.
|
void |
writeFileFooter(OrcProto.Footer.Builder builder)
Writes out the file footer.
|
void |
writeFileMetadata(OrcProto.Metadata.Builder builder)
Writes out the file metadata.
|
void |
writeHeader()
Writes the header of the file, which consists of the magic "ORC" bytes.
|
void |
writeIndex(StreamName name,
OrcProto.RowIndex.Builder index)
Write an index in the given stream name.
|
long |
writePostScript(OrcProto.PostScript.Builder builder)
Writes out the postscript (including the size byte if needed).
|
void |
writeStatistics(StreamName name,
OrcProto.ColumnStatistics.Builder statistics)
Write a stripe or file statistics to the file.
|
public PhysicalFsWriter(FileSystem fs, Path path, OrcFile.WriterOptions opts) throws IOException
IOException
public PhysicalFsWriter(FileSystem fs, Path path, OrcFile.WriterOptions opts, WriterEncryptionVariant[] encryption) throws IOException
IOException
public PhysicalFsWriter(FSDataOutputStream outputStream, OrcFile.WriterOptions opts, WriterEncryptionVariant[] encryption) throws IOException
IOException
public long getFileBytes(int column, WriterEncryptionVariant variant)
getFileBytes
in interface PhysicalWriter
column
- column from which to get file sizevariant
- the encryption variant to checkpublic StreamOptions getStreamOptions()
PhysicalWriter
getStreamOptions
in interface PhysicalWriter
public void writeFileMetadata(OrcProto.Metadata.Builder builder) throws IOException
PhysicalWriter
writeFileMetadata
in interface PhysicalWriter
builder
- Metadata builder to finalize and write.IOException
public void writeFileFooter(OrcProto.Footer.Builder builder) throws IOException
PhysicalWriter
writeFileFooter
in interface PhysicalWriter
builder
- Footer builder to finalize and write.IOException
public long writePostScript(OrcProto.PostScript.Builder builder) throws IOException
PhysicalWriter
writePostScript
in interface PhysicalWriter
builder
- Postscript builder to finalize and write.IOException
public void close() throws IOException
PhysicalWriter
close
in interface PhysicalWriter
IOException
public void flush() throws IOException
PhysicalWriter
flush
in interface PhysicalWriter
IOException
public void appendRawStripe(ByteBuffer buffer, OrcProto.StripeInformation.Builder dirEntry) throws IOException
PhysicalWriter
appendRawStripe
in interface PhysicalWriter
buffer
- Stripe data buffer.dirEntry
- File metadata entry for the stripe, to be updated with
relevant data.IOException
public void finalizeStripe(OrcProto.StripeFooter.Builder footerBuilder, OrcProto.StripeInformation.Builder dirEntry) throws IOException
PhysicalWriter
finalizeStripe
in interface PhysicalWriter
footerBuilder
- Stripe footer to be updated with relevant data and written out.dirEntry
- File metadata entry for the stripe, to be updated with
relevant data.IOException
public void writeHeader() throws IOException
PhysicalWriter
writeHeader
in interface PhysicalWriter
IOException
public org.apache.orc.impl.PhysicalFsWriter.BufferedStream createDataStream(StreamName name)
PhysicalWriter
createDataStream
in interface PhysicalWriter
name
- the name of the streamprotected OutputStream createIndexStream(StreamName name)
public void writeIndex(StreamName name, OrcProto.RowIndex.Builder index) throws IOException
PhysicalWriter
writeIndex
in interface PhysicalWriter
name
- the name of the streamindex
- the bloom filter to writeIOException
public void writeBloomFilter(StreamName name, OrcProto.BloomFilterIndex.Builder bloom) throws IOException
PhysicalWriter
writeBloomFilter
in interface PhysicalWriter
name
- the name of the streambloom
- the bloom filter to writeIOException
public void writeStatistics(StreamName name, OrcProto.ColumnStatistics.Builder statistics)
PhysicalWriter
writeStatistics
in interface PhysicalWriter
name
- the name of the streamstatistics
- the statistics to writeCopyright © 2013–2023 The Apache Software Foundation. All rights reserved.