snowflakedb / snowflakedb/snowpark-python
SNOW-3077601: Filter on empty dataframe results in schemaless dataframe
@sfc-gh-yixie is already working on this.
Since Feb 13, 2026.
- 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!
-
What version of Python are you using?
Python 3.11.13 -
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 -
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 ----------------- # - # || # - # || # - -
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.