Skip to content

Commit

Permalink
Merge branch 'master' into fix/unsafe-convertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sugar-pack authored Nov 7, 2023
2 parents ad79151 + 8445dca commit 9082216
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions chunk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,3 +611,28 @@ func TestQueryArrowStream(t *testing.T) {
}
})
}

func TestQueryArrowStreamDescribeOnly(t *testing.T) {
runSnowflakeConnTest(t, func(sct *SCTest) {
numrows := 50000 // approximately 10 ArrowBatch objects

query := fmt.Sprintf(selectRandomGenerator, numrows)
loader, err := sct.sc.QueryArrowStream(WithDescribeOnly(sct.sc.ctx), query)
assertNilF(t, err, "failed to run query")

if loader.TotalRows() != 0 {
t.Errorf("total numrows did not match expected, wanted 0, got %v", loader.TotalRows())
}

batches, err := loader.GetBatches()
assertNilF(t, err, "failed to get result")
if len(batches) != 0 {
t.Errorf("batches length did not match expected, wanted 0, got %v", len(batches))
}

rowtypes := loader.RowTypes()
if len(rowtypes) != 2 {
t.Errorf("rowTypes length did not match expected, wanted 2, got %v", len(rowtypes))
}
})
}
3 changes: 2 additions & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ func (sc *snowflakeConn) GetQueryStatus(
func (sc *snowflakeConn) QueryArrowStream(ctx context.Context, query string, bindings ...driver.NamedValue) (ArrowStreamLoader, error) {
ctx = WithArrowBatches(context.WithValue(ctx, asyncMode, false))
ctx = setResultType(ctx, queryResultType)
data, err := sc.exec(ctx, query, false, false /* isinternal */, false, bindings)
isDesc := isDescribeOnly(ctx)
data, err := sc.exec(ctx, query, false, false /* isinternal */, isDesc, bindings)
if err != nil {
logger.WithContext(ctx).Errorf("error: %v", err)
if data != nil {
Expand Down

0 comments on commit 9082216

Please sign in to comment.