Stephen-Robin commented on a change in pull request #2196:
URL: https://github.com/apache/iceberg/pull/2196#discussion_r569606595
##########
File path:
spark/src/test/java/org/apache/iceberg/actions/TestRewriteDataFilesAction.java
##########
@@ -311,6 +320,76 @@ public void testRewriteLargeTableHasResiduals() {
Assert.assertEquals("Rows must match", records, actualRecords);
}
+ @Test
+ public void testRewriteDataFilesForLargeFile() throws IOException,
AnalysisException {
+ PartitionSpec spec = PartitionSpec.unpartitioned();
+ Map<String, String> options = Maps.newHashMap();
+ Table table = TABLES.create(SCHEMA, spec, options, tableLocation);
+ Assert.assertNull("Table must be empty", table.currentSnapshot());
+
+ List<Record> excepted = Lists.newArrayList();
+ Record baseRecord = GenericRecord.create(SCHEMA);
+
+ GenericAppenderFactory genericAppenderFactory = new
GenericAppenderFactory(SCHEMA);
+ int count = 0;
+ File file = temp.newFile();
+ try (FileAppender<Record> fileAppender =
+ genericAppenderFactory.newAppender(Files.localOutput(file),
FileFormat.PARQUET)) {
+ int fileSize = 10000;
+ for (; fileAppender.length() < fileSize; count++) {
+ Record record = baseRecord.copy();
+ record.setField("c1", count);
+ record.setField("c2", "foo" + count);
+ record.setField("c3", "bar" + count);
+ fileAppender.add(record);
+ excepted.add(record);
+ }
+ }
Review comment:
Okay, thank you for your comments, I will make changes immediately
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]