Skip to content

Issue 8230 - Unit test leaf partition query lambda, simplify closing iterator - #8231

Open
patchwork01 wants to merge 16 commits into
developfrom
8230-close-iterator
Open

patchwork01 wants to merge 16 commits into
developfrom
8230-close-iterator

Conversation

@patchwork01

@patchwork01 patchwork01 commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Make sure you have checked all steps below.

Issue

  • My PR fully resolves the following issues. I've referenced an issue in the PR title, for example "Issue 1234 - My
    Feature". Note that before an issue is finished, you can still make a pull request by raising a separate issue
    for your progress.

Tests

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

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.

@patchwork01 patchwork01 changed the title Issue 8230 - Simplify closing iterator in leaf partition query lambda Issue 8230 - Unit test leaf partition query lambda, simplify closing iterator Sep 23, 2026
@patchwork01
patchwork01 marked this pull request as ready for review September 23, 2026 12:13
@patchwork01 patchwork01 added the needs-reviewer Pull requests that need a reviewer to be assigned label Sep 23, 2026
@ca61688 ca61688 self-assigned this Sep 23, 2026
Map<String, String> resultsPublisherConfig = query.getProcessingConfig().getResultsPublisherConfig();
ResultsOutputInfo outputInfo = getResultsOutput(tableProperties, resultsPublisherConfig)
.publish(query, results);
try (CloseableIterator<Row> results = getLeafPartitionQueryExecutor(tableProperties).getRows(leafPartitionQuery)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This can currently cause a query to initial get marked completed, then if the close fails the query gets reported as failed. Would it be worth trying to catch close errors and swallowing them like the old finally blocks did

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good spot, thanks. It looks like the problem is the iterator isn't closed until after the query is marked as completed. It's also not reporting the ResultsOutputInfo to the tracker if there's a failure after it returns from the results output. I'll try and get this behaviour back to the way it was.

return new NoResultsOutput();
} else {
LOGGER.error("Unknown results publisher config: {}", resultsPublisherConfig);
throw new RuntimeException("Unknown results publisher for destination: " + destination);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Previously this section returned a ResultOutput carrying the error which I believe would result in a completed-with-error status, whereas now the exception throw will cause a failed state. I just wanted to check that change was intentional?

@patchwork01 patchwork01 Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It was, but I didn't realise it was actually recording as completed in the tracker. I think that seems like a bug though, it seems incorrect to report a completed status when the client's processing configuration wasn't applied and no results were published anywhere. I think we should keep this change.

@ca61688 ca61688 assigned patchwork01 and unassigned ca61688 Sep 23, 2026
@ca61688 ca61688 removed the needs-reviewer Pull requests that need a reviewer to be assigned label Sep 23, 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.

Simplify closing iterator when using ResultsOutput

2 participants