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 Deprecated Methods Modifier and Type Method Description voidadd(T row)Deprecated.since 0.13.0, will be removed in 0.14.0; usewrite(Object)instead.voidclose()longlength()Returns the number of bytes that were currently written by this writer.DataWriteResultresult()Returns a result that contains information about writtenDataFiles orDeleteFiles.DataFiletoDataFile()voidwrite(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:FileWriterWrites a row to a predefined spec/partition.- Specified by:
writein interfaceFileWriter<T,DataWriteResult>- Parameters:
row- a data or delete record
-
add
@Deprecated public void add(T row)
Deprecated.since 0.13.0, will be removed in 0.14.0; usewrite(Object)instead.Writes a data record.
-
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,DataWriteResult>- Returns:
- the number of written bytes
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
toDataFile
public DataFile toDataFile()
-
result
public DataWriteResult 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,DataWriteResult>- Returns:
- the file writer result
-
-