deniskuzZ commented on code in PR #6856:
URL: https://github.com/apache/hive/pull/6856#discussion_r4222612299


##########
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/data/GenericAppenderHelper.java:
##########
@@ -84,27 +84,23 @@ public DataFile writeFile(StructLike partition, 
List<Record> records) throws IOE
   private static DataFile appendToLocalFile(Table table, File file, FileFormat 
format, StructLike partition,
       List<Record> records, Configuration conf)
       throws IOException {
-    GenericAppenderFactory appenderFactory = new 
GenericAppenderFactory(table.schema());
+    GenericFileWriterFactory.Builder builder = new 
GenericFileWriterFactory.Builder(table).dataFileFormat(format);
 
     // Push down ORC related settings to appender
     if (FileFormat.ORC.equals(format)) {
-      appenderFactory.setAll(conf.getValByRegex(ORC_CONFIG_PREFIX));
+      builder.writerProperties(conf.getValByRegex(ORC_CONFIG_PREFIX));
     }
 
-    FileAppender<Record> appender = appenderFactory.newAppender(
-        Files.localOutput(file), format);
-    try (FileAppender<Record> fileAppender = appender) {
-      fileAppender.addAll(records);
+    FileWriterFactory<Record> writerFactory = builder.build();
+    DataWriter<Record> appender = writerFactory.newDataWriter(
+        table.encryption().encrypt(Files.localOutput(file)), table.spec(), 
partition);
+    try (appender) {
+      for (Record r : records) {

Review Comment:
   maybe use for-each ?



-- 
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]

Reply via email to