shardulm94 commented on a change in pull request #1957:
URL: https://github.com/apache/iceberg/pull/1957#discussion_r546077547
##########
File path:
spark/src/main/java/org/apache/iceberg/spark/source/BaseDataReader.java
##########
@@ -77,16 +78,30 @@
}
public boolean next() throws IOException {
- while (true) {
- if (currentIterator.hasNext()) {
- this.current = currentIterator.next();
- return true;
- } else if (tasks.hasNext()) {
- this.currentIterator.close();
- this.currentIterator = open(tasks.next());
+ try {
+ while (true) {
+ if (currentIterator.hasNext()) {
+ this.current = currentIterator.next();
+ return true;
+ } else if (tasks.hasNext()) {
+ this.currentIterator.close();
+ this.currentTask = tasks.next();
+ this.currentIterator = open(currentTask);
+ } else {
+ this.currentIterator.close();
+ return false;
+ }
+ }
+ } catch (IOException | RuntimeException e) {
+ if (currentTask == null || currentTask.isDataTask()) {
+ throw e;
} else {
- this.currentIterator.close();
- return false;
+ String message = String.format("Error reading file: %s",
getInputFile(currentTask).location());
+ if (e instanceof IOException) {
+ throw new IOException(message, e);
+ } else {
+ throw new RuntimeException(message, e);
+ }
Review comment:
Logging the error makes sense! Thanks for the suggestion.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]