Skip to content

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Aug 8, 2025

What changes were proposed in this pull request?

This PR aims to support readFully in SparkStreamUtils and JavaUtils which is based on Java 9+ readNBytes API.

public static void readFully(InputStream in, byte[] arr, int off, int len) throws IOException {
  if (in == null || len < 0 || (off < 0 || off > arr.length - len)) {
    throw new IllegalArgumentException("Invalid input argument");
  }
  if (len != in.readNBytes(arr, off, len)) {
    throw new EOFException("Fail to read " + len + " bytes.");
  }
}

Why are the changes needed?

- ByteStreams.readFully(is, rowBuffer, 0, rowSize)
+ Utils.readFully(is, rowBuffer, 0, rowSize)

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Pass the CIs.

Was this patch authored or co-authored using generative AI tooling?

No.

@dongjoon-hyun
Copy link
Member Author

Could you review this PR when you have some time, too, @LuciferYang ?

@dongjoon-hyun
Copy link
Member Author

Could you review this PR when you have some time, @yaooqinn ?

Copy link
Contributor

@LuciferYang LuciferYang left a comment

Choose a reason for hiding this comment

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

LGTM

@dongjoon-hyun
Copy link
Member Author

Thank you, @LuciferYang !
Merged to master.

@dongjoon-hyun dongjoon-hyun deleted the SPARK-53188 branch August 8, 2025 04:19
@yaooqinn
Copy link
Member

yaooqinn commented Aug 8, 2025

Late +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants