R1cardoo opened a new issue, #11051:
URL: https://github.com/apache/iceberg/issues/11051

   ### Query engine
   
   Java SDK
   
   ### Question
   
   Hi, I'm using java SDK to insert data to my iceberg table on minio.
   Right now, I have a Exception when running   partitionedWriter.close();  
   Can you help me look into this problem, thanks! 
   
   Below is my code.
   `
   
                HiveCatalog catalog = initCatalog(awsAccessKey,awsSecretKey);
   
                // Loading Table Schema
                TableIdentifier name = TableIdentifier.of( "riri","test_rica");
                Table table = catalog.loadTable(name);
                Schema mySchema = table.schema();
   
               GenericRecord recordTemplate = 
GenericRecord.create(table.schema());
                List<Record> records = new ArrayList<>();
                Map<String, Object> m = new HashMap<>();
                m.put("id", 12193812L);
                m.put("data", "mockmockmockmock");
                records.add(recordTemplate.copy(m));
   
               InternalRecordWrapper wrapper = new 
InternalRecordWrapper(table.schema().asStruct());
                PartitionedWriter<Record> partitionedWriter = 
createPartitionedWriter(table, wrapper);
   
                try {
                        log.info("Start writing records");
                        for (Record record : records) {
                                partitionedWriter.write(record);
                        }
   
                } finally {
                        partitionedWriter.close();
                }
   
                log.info("Starting transaction");
   
                AppendFiles app = table.newAppend();
                
Arrays.stream(partitionedWriter.dataFiles()).forEach(app::appendFile);
                app.commit();
   
                log.info("Appended files");`


-- 
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: issues-unsubscr...@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to