Github user aljoscha commented on a diff in the pull request:
https://github.com/apache/flink/pull/1895#discussion_r61444801
--- Diff:
flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java
---
@@ -284,18 +322,24 @@ public T nextRecord(T record) throws IOException {
protected abstract T deserialize(T reuse, DataInputView dataInput)
throws IOException;
/**
- * Writes a block info at the end of the blocks.<br>
- * Current implementation uses only int and not long.
+ * Reads the content of a block of data. The block contains its {@link
BlockInfo}
+ * at the end, and this method takes this into account when reading the
data.
*/
- protected class BlockBasedInput extends FilterInputStream {
+ private class BlockBasedInput extends FilterInputStream {
private final int maxPayloadSize;
private int blockPos;
- public BlockBasedInput(FSDataInputStream in, int blockSize) {
+ BlockBasedInput(FSDataInputStream in, long length) {
super(in);
this.blockPos = (int)
BinaryInputFormat.this.blockInfo.getFirstRecordStart();
- this.maxPayloadSize = blockSize -
BinaryInputFormat.this.blockInfo.getInfoSize();
+ this.maxPayloadSize = (int) (length -
BinaryInputFormat.this.blockInfo.getInfoSize());
+ }
+
+ BlockBasedInput(FSDataInputStream in, int startPos, long
length) {
--- End diff --
I think we can get away with only having one constructor and calling `new
BlockBasedInput(stream, blockInfo.getFirstRecordStart(), length)` in `open()`
when not restoring from a snapshot.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---