Skip to content

SNOW-2213161: explode() with local testing in Snowpark Python fails with AttributeError #3565

@sfc-gh-ksreekandath

Description

@sfc-gh-ksreekandath

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    Python 3.11.0 (main, Jun 30 2025, 10:43:55) [Clang 17.0.0 (clang-1700.0.13.5)]

  2. What are the Snowpark Python and pandas versions in the environment?

pandas==2.3.1
snowflake-snowpark-python==1.34.0

  1. What did you do?

When attempting to use explode() function in local testing, the below error is seen.

AttributeError: 'MockSelectStatement' object has no attribute 'snowflake_plan'

Here's a step by step repro -

>>> from snowflake.snowpark import Session
>>> from snowflake.snowpark.functions import explode
>>> session = Session.builder.config('local_testing', True).create()
>>> data = [
...     {
...         "foo": "bar",
...         "my_array": ["one","two"]
...     }
... ]
>>> df = session.create_dataframe(data, schema=["foo", "my_array"])
>>> df.show()
--------------------------
|"FOO"  |"MY_ARRAY"      |
--------------------------
|bar    |['one', 'two']  |
--------------------------

>>> df.select("foo", explode("my_array")).show()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ksreekandath/.pyenv/versions/case_01077035/lib/python3.11/site-packages/snowflake/snowpark/_internal/telemetry.py", line 368, in wrap
    r = func(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ksreekandath/.pyenv/versions/case_01077035/lib/python3.11/site-packages/snowflake/snowpark/_internal/utils.py", line 1120, in call_wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ksreekandath/.pyenv/versions/case_01077035/lib/python3.11/site-packages/snowflake/snowpark/dataframe.py", line 1634, in select
    new_cols, alias_cols = _get_cols_after_explode_join(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ksreekandath/.pyenv/versions/case_01077035/lib/python3.11/site-packages/snowflake/snowpark/table_function.py", line 327, in _get_cols_after_explode_join
    plan = select_statement.select([func.col._named()]).snowflake_plan
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MockSelectStatement' object has no attribute 'snowflake_plan'
>>> 

  1. What did you expect to see?
>>> from snowflake.snowpark import Session
from snowflake.snowpark.functions import explode
>>> session=Session.builder.config("connection_name","XTB17692").create()
>>> data = [
...     {
...         "foo": "bar",
...         "my_array": ["one","two"]
...     }
... ]
>>> df = session.create_dataframe(data, schema=["foo", "my_array"])
>>> df.show()
----------------------
|"FOO"  |"MY_ARRAY"  |
----------------------
|bar    |[           |
|       |  "one",    |
|       |  "two"     |
|       |]           |
----------------------

>>> df.select("foo", explode("my_array")).show()
-------------------
|"FOO"  |"VALUE"  |
-------------------
|bar    |"one"    |
|bar    |"two"    |
-------------------

>>> 
>>> 

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglocal testingLocal Testing issues/PRsstatus-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