Skip to content
Open
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 @@ -252,6 +252,8 @@ private void setCurrentReader(int index) {
@Override
public void pauseOrResumeSplits(
Collection<String> splitsToPause, Collection<String> splitsToResume) {
currentReader.pauseOrResumeSplits(splitsToPause, splitsToResume);
if (currentReader != null) {
Copy link
Contributor

@davidradl davidradl Nov 6, 2025

Choose a reason for hiding this comment

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

if it is null, should we error?
Would it fail later if we do not error here ?
Can we get an empty collection here - that we could also check for?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's normal for the currentReader to be null. I'm just not sure if this method will be invoked when it happens. So just in case.

Copy link
Contributor

Choose a reason for hiding this comment

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

I had a look at the non test code, I see

pauseOrResumeSplits(Collections.singletonList(splitId), Collections.emptyList());

as the 2 callers that end up in this code - both of whom call this with a non null. I suggest we do not need the null check as this parameter is never null. Did I miss anything?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Actually we had used the version without the null check for several months internally and didn't hit any issues. It implies the null check could be redundant. However, potentially more code will use this method in the future. So adding the check would be a defensive measure (I actually forgot to push this commit to my previous PR). I'm fine with both.

currentReader.pauseOrResumeSplits(splitsToPause, splitsToResume);
}
}
}
Loading