Skip to content

Validate column names in Polars DataFrame.sort(), filter(), etc #5034

Description

@trashpan

Describe the Bug

Pyrefly emits [unknown-column] when invalid column names are passed to select(), drop(), cast(). However, pyrefly does not do the same for schema-preserving operations like DataFrame.sort(), filter(), etc.

import polars as pl
df = pl.DataFrame({"date": [1]})
df.select("nonexistent")  # emits unknown-column, as expected.
df.sort("nonexistent")    # pyrefly is silent - unexpected!

Expectation: Pyrefly should validate column names even for schema-preserving operations.
Tested on pyrefly 1.3.1

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions