Package org.apache.iceberg.io
Class ClusteredDataWriter<T>
java.lang.Object
org.apache.iceberg.io.ClusteredDataWriter<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,PartitioningWriter<T,
DataWriteResult>
A data writer capable of writing to multiple specs and partitions that requires the incoming
records to be properly clustered by partition spec and by partition within each spec.
-
Constructor Summary
ConstructorDescriptionClusteredDataWriter
(FileWriterFactory<T> writerFactory, OutputFileFactory fileFactory, FileIO io, long targetFileSizeInBytes) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addResult
(DataWriteResult result) protected DataWriteResult
void
close()
protected FileWriter<T,
DataWriteResult> newWriter
(PartitionSpec spec, StructLike partition) final DataWriteResult
result()
Returns a result that contains information about writtenDataFile
s orDeleteFile
s.void
write
(T row, PartitionSpec spec, StructLike partition) Writes a row to the provided spec/partition.
-
Constructor Details
-
ClusteredDataWriter
public ClusteredDataWriter(FileWriterFactory<T> writerFactory, OutputFileFactory fileFactory, FileIO io, long targetFileSizeInBytes)
-
-
Method Details
-
newWriter
-
addResult
-
aggregatedResult
-
write
Description copied from interface:PartitioningWriter
Writes a row to the provided spec/partition.- Specified by:
write
in interfacePartitioningWriter<T,
R> - Parameters:
row
- a data or delete recordspec
- a partition specpartition
- a partition or null if the spec is unpartitioned
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
result
Description copied from interface:PartitioningWriter
Returns a result that contains information about writtenDataFile
s orDeleteFile
s. The result is valid only after the writer is closed.- Specified by:
result
in interfacePartitioningWriter<T,
R> - Returns:
- the writer result
-