Package org.apache.orc.impl
Class PhysicalFsWriter
java.lang.Object
org.apache.orc.impl.PhysicalFsWriter
- All Implemented Interfaces:
PhysicalWriter
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Record the information about each column encryption variant.Nested classes/interfaces inherited from interface org.apache.orc.PhysicalWriter
PhysicalWriter.OutputReceiver
-
Constructor Summary
ConstructorDescriptionPhysicalFsWriter
(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) -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendRawStripe
(ByteBuffer buffer, OrcProto.StripeInformation.Builder dirEntry) Appends raw stripe data (e.g.void
close()
Closes the writer.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.Get the unencrypted stream options for this file.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
Writes out the file metadata.void
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
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.
-
Constructor Details
-
PhysicalFsWriter
- Throws:
IOException
-
PhysicalFsWriter
public PhysicalFsWriter(FileSystem fs, Path path, OrcFile.WriterOptions opts, WriterEncryptionVariant[] encryption) throws IOException - Throws:
IOException
-
PhysicalFsWriter
public PhysicalFsWriter(FSDataOutputStream outputStream, OrcFile.WriterOptions opts, WriterEncryptionVariant[] encryption) throws IOException - Throws:
IOException
-
-
Method Details
-
getFileBytes
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. excludes index- Specified by:
getFileBytes
in interfacePhysicalWriter
- Parameters:
column
- column from which to get file sizevariant
- the encryption variant to check- Returns:
- number of bytes for the given column
-
getStreamOptions
Description copied from interface:PhysicalWriter
Get the unencrypted stream options for this file. This class needs the stream options to write the indexes and footers. Additionally, the LLAP CacheWriter wants to disable the generic compression.- Specified by:
getStreamOptions
in interfacePhysicalWriter
-
writeFileMetadata
Description copied from interface:PhysicalWriter
Writes out the file metadata.- Specified by:
writeFileMetadata
in interfacePhysicalWriter
- Parameters:
builder
- Metadata builder to finalize and write.- Throws:
IOException
-
writePostScript
Description copied from interface:PhysicalWriter
Writes out the postscript (including the size byte if needed).- Specified by:
writePostScript
in interfacePhysicalWriter
- Parameters:
builder
- Postscript builder to finalize and write.- Throws:
IOException
-
close
Description copied from interface:PhysicalWriter
Closes the writer.- Specified by:
close
in interfacePhysicalWriter
- Throws:
IOException
-
flush
Description copied from interface:PhysicalWriter
Flushes the writer so that readers can see the preceding postscripts.- Specified by:
flush
in interfacePhysicalWriter
- Throws:
IOException
-
appendRawStripe
public void appendRawStripe(ByteBuffer buffer, OrcProto.StripeInformation.Builder dirEntry) throws IOException Description copied from interface:PhysicalWriter
Appends raw stripe data (e.g. for file merger).- Specified by:
appendRawStripe
in interfacePhysicalWriter
- Parameters:
buffer
- Stripe data buffer.dirEntry
- File metadata entry for the stripe, to be updated with relevant data.- Throws:
IOException
-
writeHeader
Description copied from interface:PhysicalWriter
Writes the header of the file, which consists of the magic "ORC" bytes.- Specified by:
writeHeader
in interfacePhysicalWriter
- Throws:
IOException
-
createDataStream
Description copied from interface:PhysicalWriter
Create an OutputReceiver for the given name.- Specified by:
createDataStream
in interfacePhysicalWriter
- Parameters:
name
- the name of the stream
-
createIndexStream
-
writeIndex
Description copied from interface:PhysicalWriter
Write an index in the given stream name.- Specified by:
writeIndex
in interfacePhysicalWriter
- Parameters:
name
- the name of the streamindex
- the bloom filter to write- Throws:
IOException
-
writeBloomFilter
public void writeBloomFilter(StreamName name, OrcProto.BloomFilterIndex.Builder bloom) throws IOException Description copied from interface:PhysicalWriter
Write a bloom filter index in the given stream name.- Specified by:
writeBloomFilter
in interfacePhysicalWriter
- Parameters:
name
- the name of the streambloom
- the bloom filter to write- Throws:
IOException
-
writeStatistics
Description copied from interface:PhysicalWriter
Write a stripe or file statistics to the file.- Specified by:
writeStatistics
in interfacePhysicalWriter
- Parameters:
name
- the name of the streamstatistics
- the statistics to write
-
toString
-