rdblue commented on a change in pull request #3567:
URL: https://github.com/apache/iceberg/pull/3567#discussion_r753852328
##########
File path:
spark/v3.2/spark/src/test/java/org/apache/iceberg/spark/actions/TestNewRewriteDataFilesAction.java
##########
@@ -196,48 +199,36 @@ public void testBinPackWithDeletes() throws Exception {
CloseableIterable<FileScanTask> tasks = table.newScan().planFiles();
List<DataFile> dataFiles =
Lists.newArrayList(CloseableIterable.transform(tasks, FileScanTask::file));
- GenericAppenderFactory appenderFactory = new
GenericAppenderFactory(table.schema(), table.spec(),
- null, null, null);
int total = (int)
dataFiles.stream().mapToLong(ContentFile::recordCount).sum();
RowDelta rowDelta = table.newRowDelta();
- // remove 2 rows for odd files, 1 row for even files
- for (int i = 0; i < dataFiles.size(); i++) {
- DataFile dataFile = dataFiles.get(i);
- EncryptedOutputFile outputFile = EncryptedFiles.encryptedOutput(
-
table.io().newOutputFile(table.locationProvider().newDataLocation(UUID.randomUUID().toString())),
- EncryptionKeyMetadata.EMPTY);
- PositionDeleteWriter<Record> posDeleteWriter =
appenderFactory.newPosDeleteWriter(
- outputFile, FileFormat.PARQUET, dataFile.partition());
- posDeleteWriter.delete(dataFile.path(), 0);
- posDeleteWriter.close();
- rowDelta.addDeletes(posDeleteWriter.toDeleteFile());
-
- if (i % 2 != 0) {
- outputFile = EncryptedFiles.encryptedOutput(
-
table.io().newOutputFile(table.locationProvider().newDataLocation(UUID.randomUUID().toString())),
- EncryptionKeyMetadata.EMPTY);
- posDeleteWriter = appenderFactory.newPosDeleteWriter(outputFile,
FileFormat.PARQUET, dataFile.partition());
- posDeleteWriter.delete(dataFile.path(), 1);
- posDeleteWriter.close();
- rowDelta.addDeletes(posDeleteWriter.toDeleteFile());
- }
+ // add 1 delete for the files 0, 1, 2
+ for (int i = 0; i < 3; i++) {
+ writePosDeletesToFile(table, dataFiles.get(i), 1, 1)
+ .forEach(rowDelta::addDeletes);
+ }
+
+ // add 2 deletes for files 3, 4
Review comment:
2 delete files?
##########
File path:
spark/v3.2/spark/src/test/java/org/apache/iceberg/spark/actions/TestNewRewriteDataFilesAction.java
##########
@@ -196,48 +199,36 @@ public void testBinPackWithDeletes() throws Exception {
CloseableIterable<FileScanTask> tasks = table.newScan().planFiles();
List<DataFile> dataFiles =
Lists.newArrayList(CloseableIterable.transform(tasks, FileScanTask::file));
- GenericAppenderFactory appenderFactory = new
GenericAppenderFactory(table.schema(), table.spec(),
- null, null, null);
int total = (int)
dataFiles.stream().mapToLong(ContentFile::recordCount).sum();
RowDelta rowDelta = table.newRowDelta();
- // remove 2 rows for odd files, 1 row for even files
- for (int i = 0; i < dataFiles.size(); i++) {
- DataFile dataFile = dataFiles.get(i);
- EncryptedOutputFile outputFile = EncryptedFiles.encryptedOutput(
-
table.io().newOutputFile(table.locationProvider().newDataLocation(UUID.randomUUID().toString())),
- EncryptionKeyMetadata.EMPTY);
- PositionDeleteWriter<Record> posDeleteWriter =
appenderFactory.newPosDeleteWriter(
- outputFile, FileFormat.PARQUET, dataFile.partition());
- posDeleteWriter.delete(dataFile.path(), 0);
- posDeleteWriter.close();
- rowDelta.addDeletes(posDeleteWriter.toDeleteFile());
-
- if (i % 2 != 0) {
- outputFile = EncryptedFiles.encryptedOutput(
-
table.io().newOutputFile(table.locationProvider().newDataLocation(UUID.randomUUID().toString())),
- EncryptionKeyMetadata.EMPTY);
- posDeleteWriter = appenderFactory.newPosDeleteWriter(outputFile,
FileFormat.PARQUET, dataFile.partition());
- posDeleteWriter.delete(dataFile.path(), 1);
- posDeleteWriter.close();
- rowDelta.addDeletes(posDeleteWriter.toDeleteFile());
- }
+ // add 1 delete for the files 0, 1, 2
Review comment:
1 delete file?
--
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]