public class DataWriter<T> extends java.lang.Object implements FileWriter<T,DataWriteResult>
Constructor and 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) |
Modifier and Type | Method and 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 written
DataFile s or DeleteFile s. |
DataFile |
toDataFile() |
void |
write(T row)
Writes a row to a predefined spec/partition.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
write
public DataWriter(FileAppender<T> appender, FileFormat format, java.lang.String location, PartitionSpec spec, StructLike partition, EncryptionKeyMetadata keyMetadata)
public DataWriter(FileAppender<T> appender, FileFormat format, java.lang.String location, PartitionSpec spec, StructLike partition, EncryptionKeyMetadata keyMetadata, SortOrder sortOrder)
public void write(T row)
FileWriter
write
in interface FileWriter<T,DataWriteResult>
row
- a data or delete recordpublic long length()
FileWriter
length
in interface FileWriter<T,DataWriteResult>
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public DataFile toDataFile()
public DataWriteResult result()
FileWriter
DataFile
s or DeleteFile
s. The result is valid only after the writer is closed.result
in interface FileWriter<T,DataWriteResult>