Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public boolean next() {
return true;
}
} catch (IOException e) {
throw new RuntimeException(e);
throw failure("load a batch from", e);
}
closeCurrentReader();
}
Expand All @@ -119,7 +119,7 @@ public ColumnarBatch get() {
try {
root = currentReader.getVectorSchemaRoot();
} catch (IOException e) {
throw new RuntimeException(e);
throw failure("read the loaded batch of", e);
}

int rowCount = root.getRowCount();
Expand Down Expand Up @@ -157,12 +157,17 @@ public void close() {
session = null;
}

/** Wraps a failure with the paths being read, the one fact a stack trace alone does not give. */
private RuntimeException failure(String what, IOException cause) {
return new RuntimeException(String.format("Failed to %s %s", what, spark.paths()), cause);
}

private void closeCurrentReader() {
if (currentReader != null) {
try {
currentReader.close();
} catch (IOException e) {
throw new RuntimeException(e);
throw failure("close the reader over", e);
}
currentReader = null;
}
Expand Down
Loading