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

fix(go/adbc/driver/snowflake): handle empty result sets #1805

Merged
merged 3 commits into from
May 4, 2024
Merged

Conversation

lidavidm
Copy link
Member

@lidavidm lidavidm commented May 3, 2024

Fixes #1804.

@lidavidm lidavidm marked this pull request as ready for review May 3, 2024 02:20
@lidavidm lidavidm requested a review from zeroshade as a code owner May 3, 2024 02:20
Comment on lines 675 to 681
} else {
schema, err := rowTypesToArrowSchema(ctx, ld, useHighPrecision)
if err != nil {
return nil, err
}
rdr.schema, _ = getTransformer(schema, ld, useHighPrecision)
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we make this a bit more readable by flipping the condition and then just returning early in this case?

if len(batches) == 0 {
    schema, err := rowTypesToArrowSchema(ctx, ld, useHighPrecision)
    if err != nil {
        return nil, err
    }
    rdr.schema, _ = getTransformer(schema, ld, useHighPrecision)
    return rdr, nil
}

// rest of code for channel management

Copy link
Member

Choose a reason for hiding this comment

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

we could even skip all of the channel creation etc. for this case too most likely

@lidavidm lidavidm requested a review from zeroshade May 3, 2024 23:53
Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

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

LGTM should we add a pure go test for the same?

@lidavidm
Copy link
Member Author

lidavidm commented May 4, 2024

Added!

@lidavidm lidavidm merged commit 2e044e8 into main May 4, 2024
96 checks passed
@lidavidm lidavidm deleted the gh-1804 branch May 4, 2024 11:13
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.

go/adbc/driver/snowflake: panic on ExecuteQuery
2 participants