rdblue commented on a change in pull request #2933:
URL: https://github.com/apache/iceberg/pull/2933#discussion_r682732106
##########
File path:
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowReader.java
##########
@@ -252,17 +297,11 @@ public boolean hasNext() {
}
} catch (IOException | RuntimeException e) {
if (currentTask != null && !currentTask.isDataTask()) {
- throw new RuntimeException(
- "Error reading file: " + getInputFile(currentTask).location() +
- ". Reason: the current task is not a data task, i.e. it
cannot read data rows. " +
- "Ensure that the tasks passed to the constructor are data
tasks. " +
- "The file scan tasks are: " + fileTasks,
- e);
- } else {
- throw new RuntimeException(
- "An error occurred while iterating through the file scan tasks
or closing the iterator," +
- " see the stacktrace for further information. The file scan
tasks are: " + fileTasks, e);
+ LOG.error("Error reading file: {}",
getInputFile(currentTask).location(), e);
}
+ // Wrap and throw a Runtime exception because Iterator::hasNext()
+ // cannot throw a checked exception.
+ throw new RuntimeException(e);
Review comment:
If the exception is already a `RuntimeException` then this should not
wrap it in another because that may change the exception type. You can use
`ExceptionUtil.castAndThrow(e, RuntimeException.class);` for this.
--
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]