Package org.apache.iceberg.io
Class DataWriter<T>
- java.lang.Object
-
- org.apache.iceberg.io.DataWriter<T>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,FileWriter<T,DataWriteResult>
public class DataWriter<T> extends java.lang.Object implements FileWriter<T,DataWriteResult>
-
-
Constructor Summary
Constructors Constructor Description DataWriter(FileAppender<T> appender, FileFormat format, java.lang.String location, PartitionSpec spec, StructLike partition, EncryptionKeyMetadata keyMetadata)
DataWriter(FileAppender<T> appender, FileFormat format, java.lang.String location, PartitionSpec spec, StructLike partition, EncryptionKeyMetadata keyMetadata, SortOrder sortOrder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
long
length()
Returns the number of bytes that were currently written by this writer.DataWriteResult
result()
Returns a result that contains information about writtenDataFile
s orDeleteFile
s.DataFile
toDataFile()
void
write(T row)
Writes a row to a predefined spec/partition.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.iceberg.io.FileWriter
write
-
-
-
-
Constructor Detail
-
DataWriter
public DataWriter(FileAppender<T> appender, FileFormat format, java.lang.String location, PartitionSpec spec, StructLike partition, EncryptionKeyMetadata keyMetadata)
-
DataWriter
public DataWriter(FileAppender<T> appender, FileFormat format, java.lang.String location, PartitionSpec spec, StructLike partition, EncryptionKeyMetadata keyMetadata, SortOrder sortOrder)
-
-
Method Detail
-
write
public void write(T row)
Description copied from interface:FileWriter
Writes a row to a predefined spec/partition.- Specified by:
write
in interfaceFileWriter<T,DataWriteResult>
- Parameters:
row
- a data or delete record
-
length
public long length()
Description copied from interface:FileWriter
Returns the number of bytes that were currently written by this writer.- Specified by:
length
in interfaceFileWriter<T,DataWriteResult>
- Returns:
- the number of written bytes
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
toDataFile
public DataFile toDataFile()
-
result
public DataWriteResult result()
Description copied from interface:FileWriter
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 interfaceFileWriter<T,DataWriteResult>
- Returns:
- the file writer result
-
-