Skip to content

Bug: False positive bad-argument-count for PySpark Column methods #3465

@feliblo

Description

@feliblo

Describe the Bug

Description

Pyrefly incorrectly reports bad-argument-count for zero-argument PySpark Column methods, claiming each call is missing one positional argument.

Affected methods

  • .isNull()
  • .isNotNull()
  • .asc()
  • .desc()
  • .eqNullSafe(other)

Example

from pyspark.sql import functions as F

F.col("x").isNull()       # ERROR: Expected 1 more positional argument
F.col("x").isNotNull()    # ERROR: Expected 1 more positional argument
F.col("x").asc()          # ERROR: Expected 1 more positional argument
F.col("x").desc()         # ERROR: Expected 1 more positional argument
F.col("x").eqNullSafe(F.col("y"))  # ERROR: Expected 1 more positional argument

Expected behavior

No errors. These are valid zero-argument (or single-argument) methods on pyspark.sql.Column.

Environment

pyrefly: >=1.0.0
pyspark: 3.5.5
preset: legacy

Workaround

[tool.pyrefly.errors]
bad-argument-count = "ignore"

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions