snowflakedb / snowflakedb/snowpark-python

SNOW-3077601: Filter on empty dataframe results in schemaless dataframe

Open
#4,076 2 comments 0 reactions 2 assignees View on GitHub

@sfc-gh-yixie is already working on this.

Since Feb 13, 2026.

bug local testing status-triage_done
Dominant language
Python
Stars
341
Forks
155
Avg merge
4d 16h
Merged PRs (30d)
27

Description

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    Python 3.11.13

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

    pandas==2.1.4
    pandas-gbq==0.31.0
    snowflake-snowpark-python==1.42.0
    
  3. What did you do?

    When I created an empty dataframe with 2 columns. I tried to filter based on one of the column, but instead of returning a duplication of that empty dataframe, it returns a dataframe with no columns at all.

    empty_schema = StructType([
             StructField("entry", StringType(), True),
             StructField("file_path", StringType(), True),
         ])
    mock_encounters_df = session.create_dataframe([], schema=empty_schema)
    
    mock_encounters_df.show()
    print("--------------- filter -----------------")
    mock_encounters_df.filter(col("entry").is_null()).show()
    
    # -------------------------
    # |"ENTRY"  |"FILE_PATH"  |
    # -------------------------
    # |         |             |
    # -------------------------
    # --------------- filter -----------------
    # -
    # ||
    # -
    # ||
    # -
    
  4. What did you expect to see?

    The expectation is to see the same dataframe I used before the filter so the output will be:

    -------------------------
    |"ENTRY"  |"FILE_PATH"  |
    -------------------------
    |         |             |
    -------------------------
    --------------- filter -----------------
    -------------------------
    |"ENTRY"  |"FILE_PATH"  |
    -------------------------
    |         |             |
    -------------------------
    

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.