public class BasePositionDeltaWriter<T> extends java.lang.Object implements PositionDeltaWriter<T>
Constructor and Description |
---|
BasePositionDeltaWriter(PartitioningWriter<T,DataWriteResult> insertWriter,
PartitioningWriter<T,DataWriteResult> updateWriter,
PartitioningWriter<PositionDelete<T>,DeleteWriteResult> deleteWriter) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
delete(java.lang.CharSequence path,
long pos,
T row,
PartitionSpec spec,
StructLike partition)
Deletes a position in the provided spec/partition and records the deleted row in the delete
file.
|
void |
insert(T row,
PartitionSpec spec,
StructLike partition)
Inserts a row to the provided spec/partition.
|
WriteResult |
result()
Returns a result that contains information about written
DataFile s or DeleteFile s. |
void |
update(T row,
PartitionSpec spec,
StructLike partition)
Inserts a new version of an existing row to the provided spec/partition.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
delete
public BasePositionDeltaWriter(PartitioningWriter<T,DataWriteResult> insertWriter, PartitioningWriter<T,DataWriteResult> updateWriter, PartitioningWriter<PositionDelete<T>,DeleteWriteResult> deleteWriter)
public void insert(T row, PartitionSpec spec, StructLike partition)
PositionDeltaWriter
insert
in interface PositionDeltaWriter<T>
row
- a data recordspec
- a partition specpartition
- a partition or null if the spec is unpartitionedpublic void update(T row, PartitionSpec spec, StructLike partition)
PositionDeltaWriter
This method allows writers to distinguish new and updated records. The caller must
separately invoke PositionDeltaWriter.delete(CharSequence, long, PartitionSpec, StructLike)
for the
original row position that is being updated.
update
in interface PositionDeltaWriter<T>
row
- a new version of an existing rowspec
- a new partition specpartition
- a new partition or null if the spec is unpartitionedpublic void delete(java.lang.CharSequence path, long pos, T row, PartitionSpec spec, StructLike partition)
PositionDeltaWriter
delete
in interface PositionDeltaWriter<T>
path
- a data file pathpos
- a positionrow
- a deleted rowspec
- a partition specpartition
- a partition or null if the spec is unpartitionedpublic WriteResult result()
PositionDeltaWriter
DataFile
s or DeleteFile
s. The result is valid only after the writer is closed.result
in interface PositionDeltaWriter<T>
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException