Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor QueryDataDecoder to return Iterator #24951

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

wendigo
Copy link
Contributor

@wendigo wendigo commented Feb 7, 2025

Iterable<List> was an initial sin, as the assumption was that you can iterate over data multiple times, which isn't true anymore for spooled segments, which are downloaded and acknowledged once the data is fully read.

Two new classes are introduced: SpooledSegmentIterator which is responsible for loading, acknowledging spooled segments, closing of the input stream for the spooled segment. This encapsulates this logic now in a single place and makes this logic reusable for other use cases. This iterator is lazy, the segment is loaded on the first row read.

Description

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Feb 7, 2025
@github-actions github-actions bot added the jdbc Relates to Trino JDBC driver label Feb 7, 2025
@wendigo wendigo requested a review from losipiuk February 7, 2025 11:27
@wendigo wendigo force-pushed the serafin/closable-iterators branch 4 times, most recently from 77d7d5e to 716f616 Compare February 7, 2025 11:51
@wendigo wendigo force-pushed the serafin/closable-iterators branch from 716f616 to 7162785 Compare February 7, 2025 11:59
Iterable<List<Object>> was an initial sin, as the assumption was that you can iterate over data
multiple times, which isn't true anymore for spooled segments, which are downloaded and acknowledged
once the data is fully read.

Two new classes are introduced: SpooledSegmentIterator which is responsible for loading, acknowledging
spooled segments, closing of the input stream for the spooled segment. This encapsulates this logic
now in a single place and makes this logic reusable for other use cases. This iterator is lazy,
the segment is loaded on the first row read.
@wendigo wendigo force-pushed the serafin/closable-iterators branch from 7162785 to 9e162be Compare February 7, 2025 12:59
@wendigo wendigo merged commit ac18d30 into master Feb 7, 2025
2 of 12 checks passed
@wendigo wendigo deleted the serafin/closable-iterators branch February 7, 2025 13:00
@github-actions github-actions bot added this to the 471 milestone Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed jdbc Relates to Trino JDBC driver
Development

Successfully merging this pull request may close these issues.

2 participants