Skip to content

feat(arrow/array): convert RecordReader and iterators#314

Merged
zeroshade merged 2 commits intoapache:mainfrom
zeroshade:readers-iters
Mar 17, 2025
Merged

feat(arrow/array): convert RecordReader and iterators#314
zeroshade merged 2 commits intoapache:mainfrom
zeroshade:readers-iters

Conversation

@zeroshade
Copy link
Copy Markdown
Member

Rationale for this change

With the advent of Go iterators via the iter module, we should provide some easy compatibility and canonicity for handling streams of record batches.

What changes are included in this PR?

Two new functions: ReaderFromIter and IterFromReader for converting between the RecordReader interface and an iterator of Records and errors. This should make it easy to integrate in various packages without forcing refactors or boilerplate code.

Are these changes tested?

Yes, unit tests are added for them.

Are there any user-facing changes?

No.

@zeroshade zeroshade requested review from joellubi, kou and lidavidm March 16, 2025 19:09

func (ir *iterReader) Retain() { ir.refCount.Add(1) }
func (ir *iterReader) Release() {
debug.Assert(ir.refCount.Load() > 0, "too many releases")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Technically this is a TOC/TOU error but it's a debug assertion so probably not a big deal

@zeroshade zeroshade merged commit d493460 into apache:main Mar 17, 2025
23 checks passed
@zeroshade zeroshade deleted the readers-iters branch March 17, 2025 14:24
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.

2 participants