Skip to content

SNOW-3449105 add Reset for ArrowStreamBatch method (mirror of #1782)#1792

Merged
sfc-gh-boler merged 11 commits into
masterfrom
snow-3449105-arrow-stream-batch-reset
May 14, 2026
Merged

SNOW-3449105 add Reset for ArrowStreamBatch method (mirror of #1782)#1792
sfc-gh-boler merged 11 commits into
masterfrom
snow-3449105-arrow-stream-batch-reset

Conversation

@sfc-gh-boler
Copy link
Copy Markdown
Collaborator

@sfc-gh-boler sfc-gh-boler commented May 12, 2026

Description

Adds ArrowStreamBatch.Reset() so callers can retry a chunk download after a mid-stream failure (e.g. a TCP RST from cloud storage) without re-executing the whole query.

Addresses #1781: customers using ADBC → goSnowflake from Power BI hit arrow/ipc: could not read message body: ... An existing connection was forcibly closed by the remote host. mid-stream during long Arrow reads. The TCP reset happens on the chunk download connection to S3/Azure Blob, so ClientSessionKeepAlive doesn't help — it keeps the Snowflake control-plane session alive, not the chunk transfer. Without a way to clear the cached reader, the only recovery path was re-executing the query.

Reset() closes the in-flight reader and nils out the cached rr, so the next GetStream() triggers a fresh chunk download (or, for inline RowSetBase64 batches, restores the inline reader from inlineData). The mid-read failure becomes a recoverable retry instead of a query-level redo.

Checklist

  • Added proper logging (if possible)
  • Created tests which fail without the change (if possible)
  • Extended the README / documentation, if necessary

Mirror of #1782 by @davidhcoe.

Co-authored-by: davidhcoe 13318837+davidhcoe@users.noreply.github.com

@sfc-gh-boler sfc-gh-boler requested a review from a team as a code owner May 12, 2026 10:51
davidhcoe and others added 8 commits May 13, 2026 11:58
Run ci/gofix.sh CI check expects []byte(fmt.Sprintf(...)) to be rewritten
as fmt.Appendf(nil, ...).

Co-authored-by: davidhcoe <13318837+davidhcoe@users.noreply.github.com>
@sfc-gh-boler sfc-gh-boler force-pushed the snow-3449105-arrow-stream-batch-reset branch from c939d64 to 2bdeb66 Compare May 13, 2026 11:58
sfc-gh-dheyman and others added 3 commits May 13, 2026 21:11
Master (#1795/#1796) added a body-only newTestArrowStreamBatch in
arrow_stream_test.go that collided with the funcGet-based helper
introduced by this PR in arrow_test.go.

Keep the funcGet helper since it's a strict superset (lets tests
control status code, error returns, and per-call body) and adapt
master's body-only call sites via a new static200OK helper.

Co-authored-by: davidhcoe <13318837+davidhcoe@users.noreply.github.com>
After master added the cancelableStream wrapper around GetStream's
return value, asserting pointer identity against the cached rr no
longer holds. Read from the returned stream and assert its bytes
match the cached reader's payload — that's the behavior the test
actually cares about.

Co-authored-by: davidhcoe <13318837+davidhcoe@users.noreply.github.com>
@sfc-gh-boler sfc-gh-boler merged commit 1a39193 into master May 14, 2026
43 of 56 checks passed
@sfc-gh-boler sfc-gh-boler deleted the snow-3449105-arrow-stream-batch-reset branch May 14, 2026 14:23
@github-actions github-actions Bot locked and limited conversation to collaborators May 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants