Skip to content

Conversation

@Rob9786
Copy link
Collaborator

@Rob9786 Rob9786 commented Jan 20, 2026

Make sure you have checked all steps below.

Issue

Tests

  • My PR adds the following tests based on our test strategy OR does not need testing for this extremely good reason:
    • QueryWebSocketIteratorTest

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it, or I have linked to a
    separate issue for that below.
  • If I have added new Java code, I have added Javadoc that explains it following our conventions and style.
  • If I have added or removed any dependencies from the project, I have updated the NOTICES file.

@Rob9786 Rob9786 changed the title 5879: Updated to pass in future 5879: Return CloseableIterator from QueryWebSocketClient Jan 20, 2026
@Rob9786 Rob9786 added the needs-reviewer Pull requests that need a reviewer to be assigned label Jan 28, 2026
@Rob9786 Rob9786 marked this pull request as ready for review January 28, 2026 08:01
if (!hasNext()) {
throw new NoSuchElementException();
}
return getRowList().remove(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will be very inefficient with the ArrayList created in handleResults, as it copies all the data in handleResults, and it will need to move all the elements of the array along one place. I don't think we can merge this as is.

We can add a field for the current index in the list, call get instead of remove here, and stop copying the list in handleResults?

if (timeoutMilliseconds >= 0) {
return future.get(timeoutMilliseconds, TimeUnit.MILLISECONDS);
} else {
return future.get();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should probably avoid calling the get methods every time we call the hasNext/next methods. We can hold the list in a field and check whether that's set before we fall back to the future.

@patchwork01 patchwork01 removed the needs-reviewer Pull requests that need a reviewer to be assigned label Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prepare a CloseableIterator to be returned from QueryWebSocketClient

3 participants