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

   ### Apache Iceberg version
   
   1.7.1
   
   ### Query engine
   
   None
   
   ### Please describe the bug 🐞
   
   When writing data using Iceberg on local Minio with the Hadoop catalog, 
everything works fine. However, when switching to Nessie catalog or REST 
catalog, an exception occurs after the first write operation.
   Steps to Reproduce
   
   -     Write data using Iceberg with the Hadoop catalog (works fine).
   -     Switch to Nessie or REST catalog.
   -     Perform the first write (succeeds).
   -     Attempt a second write (fails with an exception).
   
   
   My code: 
   
   `  public void insert(List<Record> records, String tableName) {
   
       String fileName = UUID.randomUUID().toString();
       Table table = getTable(tableName);
   
       Map<String, List<Record>> partitionedRecords =
           records.stream().collect(Collectors.groupingBy(rec ->
               Objects.equals(table.spec(), PartitionSpec.unpartitioned()) ?
                   table.locationProvider().newDataLocation(fileName) :
                   table.locationProvider().newDataLocation(table.spec(), rec, 
fileName))
           );
   
       List<DataFile> dataFiles =
           partitionedRecords.entrySet().stream()
               .map(e -> writeRecordsToFile(e.getKey(), e.getValue(), 
table)).toList();
   
       addFilesToTable(dataFiles, table);
     }
   
     private void addFilesToTable(List<DataFile> dataFiles, Table table) {
       AppendFiles appendFiles = table.newAppend();
       dataFiles.forEach(appendFiles::appendFile);
       appendFiles.commit();
     }`
   
   Exception:
   
   `java.lang.IllegalStateException: Cannot create data file from unclosed 
writer`
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [x] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


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