Skip to content

Commit

Permalink
Merge pull request apache#21739: Fix for increased FAILED_PRECONDITIO…
Browse files Browse the repository at this point in the history
…N errors in BQ Read API.
  • Loading branch information
chamikaramj authored Jun 8, 2022
2 parents 163bafd + ea0015d commit 3778799
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ public synchronized BigQueryStorageStreamSource<T> getCurrentSource() {
}

@Override
@SuppressWarnings("ReturnValueIgnored")
public @Nullable BoundedSource<T> splitAtFraction(double fraction) {
// Because superclass cannot have preconditions around these variables, cannot use
// @RequiresNonNull
Expand Down Expand Up @@ -355,6 +356,10 @@ public synchronized BigQueryStorageStreamSource<T> getCurrentSource() {
.build(),
source.readSession.getTable());
newResponseIterator = newResponseStream.iterator();
// The following line is required to trigger the `FailedPreconditionException` on which
// the SplitReadStream validation logic depends. Removing it will cause incorrect
// split operations to succeed.
newResponseIterator.hasNext();
} catch (FailedPreconditionException e) {
// The current source has already moved past the split point, so this split attempt
// is unsuccessful.
Expand Down

0 comments on commit 3778799

Please sign in to comment.