Package org.apache.iceberg.io
Class RollingDataWriter<T>
java.lang.Object
org.apache.iceberg.io.RollingDataWriter<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,FileWriter<T,DataWriteResult>
A rolling data writer that splits incoming data into multiple files within one spec/partition
based on the target file size.
-
Constructor Summary
ConstructorsConstructorDescriptionRollingDataWriter(FileWriterFactory<T> writerFactory, OutputFileFactory fileFactory, FileIO io, long targetFileSizeInBytes, PartitionSpec spec, StructLike partition) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddResult(DataWriteResult result) protected DataWriteResultvoidclose()longlonglength()Returns the number of bytes that were currently written by this writer.protected DataWriter<T> newWriter(EncryptedOutputFile file) protected voidprotected StructLikefinal DataWriteResultresult()Returns a result that contains information about writtenDataFiles orDeleteFiles.protected PartitionSpecspec()voidWrites a row to a predefined spec/partition.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.iceberg.io.FileWriter
write
-
Constructor Details
-
RollingDataWriter
public RollingDataWriter(FileWriterFactory<T> writerFactory, OutputFileFactory fileFactory, FileIO io, long targetFileSizeInBytes, PartitionSpec spec, StructLike partition)
-
-
Method Details
-
newWriter
-
addResult
-
aggregatedResult
-
spec
-
partition
-
currentFilePath
-
currentFileRows
public long currentFileRows() -
length
public long length()Description copied from interface:FileWriterReturns the number of bytes that were currently written by this writer.- Specified by:
lengthin interfaceFileWriter<T,W extends FileWriter<T, R>> - Returns:
- the number of written bytes
-
write
Description copied from interface:FileWriterWrites a row to a predefined spec/partition.- Specified by:
writein interfaceFileWriter<T,W extends FileWriter<T, R>> - Parameters:
row- a data or delete record
-
openCurrentWriter
protected void openCurrentWriter() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
result
Description copied from interface:FileWriterReturns a result that contains information about writtenDataFiles orDeleteFiles. The result is valid only after the writer is closed.- Specified by:
resultin interfaceFileWriter<T,W extends FileWriter<T, R>> - Returns:
- the file writer result
-