Skip to content

[SPARK-52428] Column missing comparison methods (gt, lt, ge, le) #42

@rafafrdz

Description

@rafafrdz

Problem

The Column struct supports comparison via Rust operator overloading (>, <, >=, <=), but lacks explicit method equivalents like .gt(), .lt(), .ge(), .le().

PySpark, the Go client, and the Scala client all provide these as methods. They are essential for method chaining patterns:

// This doesn't work:
df.filter(col("age").gt(lit(27)))

// Workaround requires wrapping in parentheses:
df.filter(col("age") > lit(27))  // only works if filter accepts Column directly

// Or using string expressions:
df.filter("age > 27")

Proposed solution

Add comparison methods to Column:

  • gt(other) — greater than
  • lt(other) — less than
  • ge(other) / gte(other) — greater than or equal
  • le(other) / lte(other) — less than or equal

These should use the same UnresolvedFunction pattern as the existing eq method, calling the appropriate Spark comparison functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions