Package org.apache.orc
Interface PhysicalWriter
- All Known Implementing Classes:
PhysicalFsWriter
public interface PhysicalWriter
This interface separates the physical layout of ORC files from the higher
level details.
This API is limited to being used by LLAP.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
The target of an output stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendRawStripe
(ByteBuffer stripe, 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.void
finalizeStripe
(OrcProto.StripeFooter.Builder footer, 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.Get the unencrypted stream options for this file.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.
-
Method Details
-
writeHeader
Writes the header of the file, which consists of the magic "ORC" bytes.- Throws:
IOException
-
createDataStream
Create an OutputReceiver for the given name.- Parameters:
name
- the name of the stream- Throws:
IOException
-
writeIndex
Write an index in the given stream name.- Parameters:
name
- the name of the streamindex
- the bloom filter to write- Throws:
IOException
-
writeBloomFilter
Write a bloom filter index in the given stream name.- Parameters:
name
- the name of the streambloom
- the bloom filter to write- Throws:
IOException
-
writeStatistics
void writeStatistics(StreamName name, OrcProto.ColumnStatistics.Builder statistics) throws IOException Write a stripe or file statistics to the file.- Parameters:
name
- the name of the streamstatistics
- the statistics to write- Throws:
IOException
-
writeFileMetadata
Writes out the file metadata.- Parameters:
builder
- Metadata builder to finalize and write.- Throws:
IOException
-
writePostScript
Writes out the postscript (including the size byte if needed).- Parameters:
builder
- Postscript builder to finalize and write.- Throws:
IOException
-
close
Closes the writer.- Throws:
IOException
-
flush
Flushes the writer so that readers can see the preceding postscripts.- Throws:
IOException
-
appendRawStripe
void appendRawStripe(ByteBuffer stripe, OrcProto.StripeInformation.Builder dirEntry) throws IOException Appends raw stripe data (e.g. for file merger).- Parameters:
stripe
- Stripe data buffer.dirEntry
- File metadata entry for the stripe, to be updated with relevant data.- Throws:
IOException
-
getFileBytes
Get the number of bytes for a file in a given column.- Parameters:
column
- column from which to get file sizevariant
- the encryption variant to check- Returns:
- number of bytes for the given column
-
getStreamOptions
StreamOptions getStreamOptions()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.
-