deniskuzZ commented on code in PR #5961: URL: https://github.com/apache/hive/pull/5961#discussion_r2240962543
########## iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/writer/WriterBuilder.java: ########## @@ -120,27 +132,69 @@ public HiveIcebergWriter build() { HiveIcebergWriter writer; boolean isCOW = IcebergTableUtil.isCopyOnWriteMode(operation, table.properties()::getOrDefault); + if (isCOW) { writer = new HiveIcebergCopyOnWriteRecordWriter(table, writerFactory, dataFileFactory, context); } else { - switch (operation) { - case DELETE: - writer = new HiveIcebergDeleteWriter(table, writerFactory, deleteFileFactory, context); - break; - case OTHER: - writer = new HiveIcebergRecordWriter(table, writerFactory, dataFileFactory, context); - break; - default: - // Update and Merge should be splitted to inserts and deletes - throw new IllegalArgumentException("Unsupported operation when creating IcebergRecordWriter: " + - operation.name()); - } + writer = switch (operation) { + case DELETE -> + new HiveIcebergDeleteWriter(table, rewritableDeletes, writerFactory, deleteFileFactory, context); + case OTHER -> + new HiveIcebergRecordWriter(table, writerFactory, dataFileFactory, context); + default -> + // Update and Merge should be splitted to inserts and deletes + throw new IllegalArgumentException("Unsupported operation when creating IcebergRecordWriter: " + + operation.name()); + }; } WriterRegistry.registerWriter(attemptID, tableName, writer); return writer; } + private Map<String, DeleteFileSet> rewritableDeletes() { + TableScan scan = table.newScan().caseSensitive(false).ignoreResiduals(); Review Comment: refactored and replaced with BatchScan -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org