Skip to content

Commit

Permalink
[SPARK-40538][CONNECT][FOLLOW-UP] Fix less than comparison in Spark C…
Browse files Browse the repository at this point in the history
…onnect expression

### What changes were proposed in this pull request?

This PR is a followup of #38270 that changes `__lt__` to use `<` that is less than comparison.

### Why are the changes needed?

To less than comparison to use `<` properly.

### Does this PR introduce _any_ user-facing change?

No, the original change is not released yet.

### How was this patch tested?

Unit test was added.

Closes #38303 from HyukjinKwon/SPARK-40538-followup.

Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
HyukjinKwon committed Oct 19, 2022
1 parent af6aa15 commit 7ea33b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/pyspark/sql/connect/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Expression(object):
"""

__gt__ = _bin_op(">")
__lt__ = _bin_op(">")
__lt__ = _bin_op("<")
__add__ = _bin_op("+")
__sub__ = _bin_op("-")
__mul__ = _bin_op("*")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def test_column_expressions(self):
the protobuf structure."""
df = c.DataFrame.withPlan(p.Read("table"))

expr = fun.lit(10) < fun.lit(10)
expr_plan = expr.to_plan(None)
self.assertIsNotNone(expr_plan.unresolved_function)
self.assertEqual(expr_plan.unresolved_function.parts[0], "<")

expr = df.id % fun.lit(10) == fun.lit(10)
expr_plan = expr.to_plan(None)
self.assertIsNotNone(expr_plan.unresolved_function)
Expand Down

0 comments on commit 7ea33b7

Please sign in to comment.