deniskuzZ commented on code in PR #3758:
URL: https://github.com/apache/hive/pull/3758#discussion_r1021897067
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/writer/HiveIcebergDeleteWriter.java:
##########
@@ -41,21 +41,31 @@
class HiveIcebergDeleteWriter extends HiveIcebergWriterBase {
private final GenericRecord rowDataTemplate;
+ private final boolean isWriteDeleteRow;
HiveIcebergDeleteWriter(Schema schema, Map<Integer, PartitionSpec> specs,
FileWriterFactory<Record> writerFactory, OutputFileFactory fileFactory,
FileIO io,
- long targetFileSize) {
+ long targetFileSize, boolean isWriteDeleteRow) {
super(schema, specs, io,
new ClusteredPositionDeleteWriter<>(writerFactory, fileFactory, io,
targetFileSize));
rowDataTemplate = GenericRecord.create(schema);
+ this.isWriteDeleteRow = isWriteDeleteRow;
}
@Override
public void write(Writable row) throws IOException {
Record rec = ((Container<Record>) row).get();
PositionDelete<Record> positionDelete =
IcebergAcidUtil.getPositionDelete(rec, rowDataTemplate);
int specId = IcebergAcidUtil.parseSpecId(rec);
- writer.write(positionDelete, specs.get(specId),
partition(positionDelete.row(), specId));
+ if (isWriteDeleteRow) {
+ writer.write(positionDelete, specs.get(specId),
partition(positionDelete.row(), specId));
Review Comment:
Could we refactor to:
````
Record rowData = positionDelete.row();
if (skipOriginalRow) {
positionDelete.set(positionDelete.path(), positionDelete.pos(), null);
}
writer.write(positionDelete, specs.get(specId), partition(rowData, specId));
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]