You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/12/18 19:29:29 UTC

[GitHub] [iceberg] RussellSpitzer commented on a change in pull request #1957: Spark: Print file location in case of error during reads

RussellSpitzer commented on a change in pull request #1957:
URL: https://github.com/apache/iceberg/pull/1957#discussion_r546048471



##########
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:
       +1 To Logging an error




----------------------------------------------------------------
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:
users@infra.apache.org



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