Package org.apache.iceberg.io
Class BasePositionDeltaWriter<T>
- java.lang.Object
-
- org.apache.iceberg.io.BasePositionDeltaWriter<T>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,PositionDeltaWriter<T>
public class BasePositionDeltaWriter<T> extends java.lang.Object implements PositionDeltaWriter<T>
-
-
Constructor Summary
Constructors Constructor Description BasePositionDeltaWriter(PartitioningWriter<T,DataWriteResult> dataWriter, PartitioningWriter<PositionDelete<T>,DeleteWriteResult> deleteWriter)
BasePositionDeltaWriter(PartitioningWriter<T,DataWriteResult> insertWriter, PartitioningWriter<T,DataWriteResult> updateWriter, PartitioningWriter<PositionDelete<T>,DeleteWriteResult> deleteWriter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 writtenDataFile
s orDeleteFile
s.void
update(T row, PartitionSpec spec, StructLike partition)
Inserts a new version of an existing row to the provided 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.PositionDeltaWriter
delete
-
-
-
-
Constructor Detail
-
BasePositionDeltaWriter
public BasePositionDeltaWriter(PartitioningWriter<T,DataWriteResult> dataWriter, PartitioningWriter<PositionDelete<T>,DeleteWriteResult> deleteWriter)
-
BasePositionDeltaWriter
public BasePositionDeltaWriter(PartitioningWriter<T,DataWriteResult> insertWriter, PartitioningWriter<T,DataWriteResult> updateWriter, PartitioningWriter<PositionDelete<T>,DeleteWriteResult> deleteWriter)
-
-
Method Detail
-
insert
public void insert(T row, PartitionSpec spec, StructLike partition)
Description copied from interface:PositionDeltaWriter
Inserts a row to the provided spec/partition.- Specified by:
insert
in interfacePositionDeltaWriter<T>
- Parameters:
row
- a data recordspec
- a partition specpartition
- a partition or null if the spec is unpartitioned
-
update
public void update(T row, PartitionSpec spec, StructLike partition)
Description copied from interface:PositionDeltaWriter
Inserts a new version of an existing row to the provided spec/partition.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.- Specified by:
update
in interfacePositionDeltaWriter<T>
- Parameters:
row
- a new version of an existing rowspec
- a new partition specpartition
- a new partition or null if the spec is unpartitioned
-
delete
public void delete(java.lang.CharSequence path, long pos, T row, PartitionSpec spec, StructLike partition)
Description copied from interface:PositionDeltaWriter
Deletes a position in the provided spec/partition and records the deleted row in the delete file.- Specified by:
delete
in interfacePositionDeltaWriter<T>
- Parameters:
path
- a data file pathpos
- a positionrow
- a deleted rowspec
- a partition specpartition
- a partition or null if the spec is unpartitioned
-
result
public WriteResult result()
Description copied from interface:PositionDeltaWriter
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 interfacePositionDeltaWriter<T>
- Returns:
- the writer result
-
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
-
-