public class SortingPositionOnlyDeleteWriter<T> extends java.lang.Object implements FileWriter<PositionDelete<T>,DeleteWriteResult>
This writer keeps an in-memory bitmap of deleted positions per each seen data file and flushes
the result into a file when closed. This enables writing position delete files when the incoming
records are not ordered by file and position as required by the spec. If the incoming deletes are
ordered by an external process, use PositionDeleteWriter
instead.
Note this writer stores only positions. It does not store deleted records.
Constructor and Description |
---|
SortingPositionOnlyDeleteWriter(FileWriter<PositionDelete<T>,DeleteWriteResult> writer) |
SortingPositionOnlyDeleteWriter(java.util.function.Supplier<FileWriter<PositionDelete<T>,DeleteWriteResult>> writers,
DeleteGranularity granularity) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
length()
Returns the number of bytes that were currently written by this writer.
|
DeleteWriteResult |
result()
Returns a result that contains information about written
DataFile s or DeleteFile s. |
void |
write(PositionDelete<T> positionDelete)
Writes a row to a predefined spec/partition.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
write
public SortingPositionOnlyDeleteWriter(FileWriter<PositionDelete<T>,DeleteWriteResult> writer)
public SortingPositionOnlyDeleteWriter(java.util.function.Supplier<FileWriter<PositionDelete<T>,DeleteWriteResult>> writers, DeleteGranularity granularity)
public void write(PositionDelete<T> positionDelete)
FileWriter
write
in interface FileWriter<PositionDelete<T>,DeleteWriteResult>
positionDelete
- a data or delete recordpublic long length()
FileWriter
length
in interface FileWriter<PositionDelete<T>,DeleteWriteResult>
public DeleteWriteResult result()
FileWriter
DataFile
s or DeleteFile
s. The result is valid only after the writer is closed.result
in interface FileWriter<PositionDelete<T>,DeleteWriteResult>
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException