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-995714 SNOW-998050 Calling stored procedure returning a table in multi-statements query fail with code = 100132 #1011

Closed
nearsyh opened this issue Dec 21, 2023 · 2 comments
Assignees

Comments

@nearsyh
Copy link

nearsyh commented Dec 21, 2023

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of GO driver are you using? 1.7.0

  2. What operating system and processor architecture are you using? MacOS Sonoma 14.1.2, ARM (Apple Sillicon, M2)

  3. What version of GO are you using? go version go1.20 darwin/arm64

4.Server version: 7.44.1

  1. What did you do?
CREATE OR REPLACE PROCEDURE test_procedure()
RETURNS TABLE()
LANGUAGE PYTHON
RUNTIME_VERSION = '3.10'
PACKAGES = ('snowflake-snowpark-python')
HANDLER = 'test_procedure'
EXECUTE AS CALLER AS
$$
def test_procedure(session):
    return session.sql("SELECT 1")
$$
----
var sqls = []string{
    "SELECT 1",
    "CALL test_procedure()"
}
// execute multiple statements
  1. What did you expect to see? What should have happened and what happened instead?

I expect that these queries can succeed, but I got errors like

server ErrorCode=100132, ErrorMessage=JavaScript execution error: Uncaught Execution of multiple statements failed on statement "CALL test_procedure(..." (at line 82, position 0).
        Missing rowset from response. No results found. 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
  1. Can you set logging to DEBUG and collect the logs?

    https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

  2. What is your Snowflake account identifier, if any? (Optional)

@nearsyh nearsyh added the bug Erroneous or unexpected behaviour label Dec 21, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Dec 29, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka added status-triage Issue is under initial triage and removed bug Erroneous or unexpected behaviour labels Dec 29, 2023
@sfc-gh-dszmolka
Copy link
Contributor

hi - thank you for submitting this issue. we'll take a look.

@sfc-gh-dszmolka sfc-gh-dszmolka changed the title Calling stored procedure returning a table in multi-statements query fail with code = 100132 SNOW-995714 Calling stored procedure returning a table in multi-statements query fail with code = 100132 Jan 2, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka changed the title SNOW-995714 Calling stored procedure returning a table in multi-statements query fail with code = 100132 SNOW-995714 SNOW-998050 Calling stored procedure returning a table in multi-statements query fail with code = 100132 Jan 2, 2024
@sfc-gh-dszmolka
Copy link
Contributor

Thank you for your patience while I was looking and also for providing the detailed description !

Reproduced the exact same behaviour with the Snowflake JDBC driver as well, so we can conclude the behaviour is not a bug and not even coming from the Snowflake Go driver - instead it is how the Snowflake backend behaves.

After some research and experimenting, I could make the multi-statement query work

SELECT 0;
CALL test_procedure();

having your stored procedure, with setting the result set to JSON:
alter account set JDBC_QUERY_RESULT_FORMAT = 'JSON';

After setting the result format to JSON, the same Java repro program started to work, which was just before exhibiting the same behaviour as you're seeing with the Go driver.

Note that you don't necessarily need to set the result format to JSON on the whole account to affect all queries; you can set it also on USER level (ALTER USER SET... ) and also on the SESSION level (ALTER SESSION SET.., this perhaps even part of the multi-statement query) . Maybe it can be a workaround for you too.

In the meantime I asked the relevant internal teams to take a look to decide if this is really the intended behaviour on the server side; and if so, document it.

For now, I'm closing this issue because it is not coming from the gosnowflake library.

@sfc-gh-dszmolka sfc-gh-dszmolka removed the status-triage Issue is under initial triage label Jan 2, 2024
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

No branches or pull requests

2 participants