Skip to content

Commit

Permalink
SNOW-880442: Add pass context to arrow fetch function
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pfus committed Aug 1, 2023
1 parent 4034084 commit 5eeb3d9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion chunk_downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,12 @@ type ArrowBatch struct {
rowCount int
scd *snowflakeChunkDownloader
funcDownloadHelper func(context.Context, *snowflakeChunkDownloader, int) error
ctx context.Context
}

func (rb *ArrowBatch) WithContext(ctx context.Context) *ArrowBatch {

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / GCP Go 1.19 on Ubuntu

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AZURE Go 1.20 on Ubuntu

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AZURE Go 1.19 on Ubuntu

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / GCP Go 1.20 on Ubuntu

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AWS Go 1.20 on Ubuntu

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AWS Go 1.19 on Ubuntu

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AZURE Go 1.19 on Mac

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AWS Go 1.20 on Mac

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / GCP Go 1.20 on Mac

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AWS Go 1.19 on Mac

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AZURE Go 1.20 on Mac

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / GCP Go 1.19 on Mac

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AZURE Go 1.19 on Windows

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AWS Go 1.19 on Windows

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / GCP Go 1.19 on Windows

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AZURE Go 1.20 on Windows

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / GCP Go 1.20 on Windows

exported method ArrowBatch.WithContext should have comment or be unexported

Check failure on line 713 in chunk_downloader.go

View workflow job for this annotation

GitHub Actions / AWS Go 1.20 on Windows

exported method ArrowBatch.WithContext should have comment or be unexported
rb.ctx = ctx
return rb
}

// Fetch returns an array of records representing a chunk in the query
Expand All @@ -717,7 +723,13 @@ func (rb *ArrowBatch) Fetch() (*[]arrow.Record, error) {
rb.rowCount = countArrowBatchRows(rb.rec)
return rb.rec, nil
}
if err := rb.funcDownloadHelper(context.Background(), rb.scd, rb.idx); err != nil {
var ctx context.Context
if rb.ctx != nil {
ctx = rb.ctx
} else {
ctx = context.Background()
}
if err := rb.funcDownloadHelper(ctx, rb.scd, rb.idx); err != nil {
return nil, err
}
return rb.rec, nil
Expand Down

0 comments on commit 5eeb3d9

Please sign in to comment.