Skip to content

SNOW-2028510: "Missing rowset from response" when calling nested Python procedure from SQL procedure (via JDBC / SnowCLI) #2146

@s1ck

Description

@s1ck

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

  1. What version of JDBC driver are you using?

3.23.2

  1. What operating system and processor architecture are you using?

PopOS 22.04 / x86

  1. What version of Java are you using?

Adoptium JDK 21

  1. What did you do?

I wrote a Python procedure that returns a table (DataFrame). That procedure is called from within a SQL procedure which just stores the result of the nested procedure as result set and returns it.

CREATE OR REPLACE TABLE data AS 
    SELECT "ID" FROM VALUES (42), (43), (44), (45), (46), (47) AS TEMP_TABLE("ID");
    
CREATE OR REPLACE PROCEDURE nested_proc(table_name string)
  RETURNS TABLE(id bigint)
  LANGUAGE PYTHON
  RUNTIME_VERSION = '3.11'
  PACKAGES = ('snowflake-snowpark-python')
  HANDLER = 'run_job'
  AS
$$
import snowflake.snowpark as snowpark

def run_job(session: snowpark.Session, table_name: str) -> snowpark.DataFrame:
  return session.table(table_name)
$$;

CREATE OR REPLACE PROCEDURE outer_proc(table_name string)
  RETURNS TABLE(id bigint)
  LANGUAGE SQL AS
  DECLARE
    res resultset;
  BEGIN
    res := (CALL nested_proc(:table_name));
    RETURN TABLE(res);
  END;

CALL outer_proc('data');

When CALL outer_proc('data') is called from either JDBC directly or via SnowCLI, the response is

240010 (08004): 01bb879c-0001-b638-0001-87e201eb6252: Uncaught exception of type 'STATEMENT_ERROR' on line 4 at position 12 : Missing rowset from response. No results found.
  1. What did you expect to see?

The column values of the given table.

This works fine when calling via snowsql or directly in Snowsight.

I can confirm that it works if outer_proc is also written in Python, e.g.

CREATE OR REPLACE PROCEDURE outer_proc_python(table_name string)
  RETURNS TABLE(id bigint)
  LANGUAGE PYTHON
  RUNTIME_VERSION = '3.11'
  PACKAGES = ('snowflake-snowpark-python')
  HANDLER = 'run_job'
  AS
$$
import snowflake.snowpark as snowpark

def run_job(session: snowpark.Session, table_name: str) -> snowpark.DataFrame:
  return session.sql(f"CALL nested_proc('{table_name}')")
$$;

I assume that this is somehow related to the session which might be bound to the returned dataframe but somehow lost when the execution of the nested proc is done.

Metadata

Metadata

Assignees

Labels

bugstatus-triage_doneInitial triage done, will be further handled by the driver team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions