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

Test pr 955 #957

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading