Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -127,7 +127,6 @@ public void reset() {
@Override
public void close() {
arrayOut.close();
out.close();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out in this case is wraps arrayOut, and it has no buffering, so it does not need to be explicitly closed, or better, in the future, out should be closed only and arrayOut will be closed implicitly. Anyway, I came to this conclusion because this is how close() is implemented in a couple of other Writer classes as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would either close only arrayOut but with comments about what you have written here or close only out and catching the IOException that would never occur and comment in the catch block similarly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gszadovszky Thanks for the review!

I think this line of work should be pursued in a different ticket. This change makes this PR's changes possible, but also puts it in line with other implementations:

https://github.com/apache/parquet-mr/blob/dc61e510126aaa1a95a46fe39bf1529f394147e9/parquet-column/src/main/java/org/apache/parquet/column/values/plain/FixedLenByteArrayPlainValuesWriter.java#L88-L90

So if we want to change how things are closed (nice, but technically not required) it can be addressed holistically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine fixing this in another ticket. What I think is a key in this change is to put the related comments (out.close is not required because...) in the code as well as in this review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gszadovszky OK, finally got back to this. Ha. I added a comment. Please consider for merge.

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

/**
* Utilities for managing I/O resources.
* @deprecated
*/
@Deprecated
public class IOExceptionUtils {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/
package org.apache.parquet.bytes;

import org.apache.parquet.IOExceptionUtils;
import org.apache.parquet.ParquetRuntimeException;

import java.io.IOException;
import java.io.OutputStream;

Expand Down Expand Up @@ -210,8 +207,8 @@ public final void writeDouble(double v) throws IOException {
writeLong(Double.doubleToLongBits(v));
}

public void close() {
IOExceptionUtils.closeQuietly(out);
public void close() throws IOException {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inherited close() method throws IOException so this is fine to do

out.close();
}

}