murali-db opened a new issue, #14564:
URL: https://github.com/apache/iceberg/issues/14564
### Apache Iceberg version
1.10.0 (latest release)
### Query engine
None
### Please describe the bug 🐞
## Bug Description
`RESTFileScanTaskParser.fromJson()` throws `NoSuchElementException` when
parsing responses with empty `delete-file-references` arrays.
## Location
`core/src/main/java/org/apache/iceberg/rest/RESTFileScanTaskParser.java:90`
## Root Cause
```java
if (jsonNode.has(DELETE_FILE_REFERENCES)) {
List<Integer> indices = JsonUtil.getIntegerList(DELETE_FILE_REFERENCES,
jsonNode);
Preconditions.checkArgument(
Collections.max(indices) < allDeleteFiles.size(), // ← LINE 90:
Crashes if indices is empty
"Invalid delete file references: %s, expected indices < %s",
indices,
allDeleteFiles.size());
```
`Collections.max() throws NoSuchElementException when called on an empty
list.`
## Reproduction
1. Use Iceberg REST catalog with server-side scan planning
2. Create a table with data files but no delete files
3. Call plan table scan endpoint
4. Server returns valid JSON with "delete-file-references": []
5. Parser crashes with NoSuchElementException
## Expected Behavior
Empty delete-file-references arrays should be valid (no delete files to
reference).
If confirmed as an issue, I can contribute a bug fix for this.
### Willingness to contribute
- [x] I can contribute a fix for this bug independently
- [ ] 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: [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]