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

SNOW-1646792: Support multiple result sets in a raw Arrow format #1205

Open
CurtHagenlocher opened this issue Aug 30, 2024 · 7 comments
Open
Labels
enhancement The issue is a request for improvement or a new feature status-blocked Progressing the issue is blocked by something, probably dependencies. status-triage_done Initial triage done, will be further handled by the driver team

Comments

@CurtHagenlocher
Copy link
Contributor

What is the current behavior?

When using snowflakeConn.QueryArrowStream it's only possible to return a single result set.

What is the desired behavior?

Either via QueryArrowStream or some new function, it ought to be possible to use WithMultiStatement to execute multiple statements and get multiple results -- just as it is for the row-based interface.

How would this improve gosnowflake?

This is a generally useful scenario, and it would also go towards ultimately enabling apache/arrow-adbc#1358.

@github-actions github-actions bot changed the title Support multiple result sets in a raw Arrow format SNOW-1646792: Support multiple result sets in a raw Arrow format Aug 30, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Sep 2, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added enhancement The issue is a request for improvement or a new feature status-triage_done Initial triage done, will be further handled by the driver team labels Sep 2, 2024
@sfc-gh-dszmolka
Copy link
Contributor

sfc-gh-dszmolka commented Sep 2, 2024

hi and thanks for submitting this issue. unfortunately, multi-statement query results returned as JSON are a limitation of the Snowflake backend, and thus affects all our drivers (not just gosnowflake). Same reason as #816.
That said, it is entirely possible of course to submit a feature request for this, but it should be more like targeting the backend.

If you (or anyone reading this, needing the same feature) are already a Snowflake customer or partner, can you please reach out to your account team and let them know you would need Snowflake engine to support returning multi-statement query results as Arrow ?

I'm going to keep this issue open (indefinitely) for tracking, but please be aware that no progress can be made until backend is ready to fully support this. Thank you !

@sfc-gh-dszmolka sfc-gh-dszmolka removed their assignment Sep 2, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-blocked Progressing the issue is blocked by something, probably dependencies. label Sep 2, 2024
@seanwang051
Copy link

hi and thanks for submitting this issue. unfortunately, multi-statement query results returned as JSON are a limitation of the Snowflake backend, and thus affects all our drivers (not just gosnowflake). Same reason as #816. That said, it is entirely possible of course to submit a feature request for this, but it should be more like targeting the backend.

If you (or anyone reading this, needing the same feature) are already a Snowflake customer or partner, can you please reach out to your account team and let them know you would need Snowflake engine to support returning multi-statement query results as Arrow ?

I'm going to keep this issue open (indefinitely) for tracking, but please be aware that no progress can be made until backend is ready to fully support this. Thank you !

Hi, might be a dump question, I was using Snowflake ADO.NET driver which can return mulitple result set, was there any difference between those 2 underlying mechanisms? Please kindly help me understand it

@sfc-gh-dszmolka
Copy link
Contributor

the request is about to be able to return results of a multi-statement query in Arrow format specifically; backend needs to support this first.

@sfc-gh-pfus
Copy link
Collaborator

@seanwang051 let me clarify it a bit further. Most drivers work in row based mode - you select data and iterate over them row by row. In that case, multistatements/multiple result sets are available in all drivers. Apart from that, Go driver exposes the API mentioned above, which allows to read native arrow response in columnar manner. This is a thing that is currently supported only by Go and Python drivers (and JDBC is coming in the upcoming future). .NET driver doesn't have such API. In this case, multistatements are not supported by Snowflake backend.

@davidhcoe
Copy link

It also appears I can't multiple statements that only have one result when using Arrow. For example, I can't run:

ALTER SESSION SET MULTI_STATEMENT_COUNT = 3;

followed by

CREATE TEMPORARY TABLE temp_table (
    id INT,
    name STRING
);

INSERT INTO temp_table (id, name) VALUES
    (1, 'Alice'),
    (2, 'Bob');

SELECT * FROM temp_table;

I get the error:

JavaScript execution error: Uncaught Execution of multiple statements failed on statement "CREATE TEMPORARY TABLE temp_ta..." (at line 1, position 0). Actual statement count 1 did not match the desired statement count 3. in SYSTEM$MULTISTMT at ' throw `Execution of multiple statements failed on statement {0} (at line {1}, position {2}).`.replace('{1}', LINES[i])' position 4 stackstrace: SYSTEM$MULTISTMT line: 10

So for some reason it still sees the request as a single statement, but I still would only have one actual result.

@sfc-gh-dszmolka
Copy link
Contributor

sfc-gh-dszmolka commented Oct 18, 2024

This is very interesting @davidhcoe - and surely doesn't come from this library (gosnowflake) where this issue is raised, but the backend, Snowflake itself. If this is a problem for you, could you please raise it with Snowflake Support ?

As a mitigation, you can try using ALTER SESSION SET MULTI_STATEMENT_COUNT = 0; to allow for an undefined number of multi-statement count.

@davidhcoe
Copy link

That works @sfc-gh-dszmolka in the sense that it doesn't fail, but the only result I get back in this case is a string that says "Multiple statements executed successfully." where I would expect to get 2 results that include Bob and Alice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is a request for improvement or a new feature status-blocked Progressing the issue is blocked by something, probably dependencies. status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

5 participants