Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-43676][SPARK-43677][SPARK-43678][SPARK-43679][PS] Fix DatetimeOps for Spark Connect #41306

Closed
wants to merge 7 commits into from
17 changes: 5 additions & 12 deletions python/pyspark/pandas/data_type_ops/datetime_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
TimestampNTZType,
NumericType,
)
from pyspark.sql.utils import pyspark_column_op

from pyspark.pandas._typing import Dtype, IndexOpsLike, SeriesOrIndex
from pyspark.pandas.base import IndexOpsMixin
Expand Down Expand Up @@ -109,28 +110,20 @@ def rsub(self, left: IndexOpsLike, right: Any) -> SeriesOrIndex:
raise TypeError("Datetime subtraction can only be applied to datetime series.")

def lt(self, left: IndexOpsLike, right: Any) -> SeriesOrIndex:
from pyspark.pandas.base import column_op

_sanitize_list_like(right)
return column_op(Column.__lt__)(left, right)
return pyspark_column_op("__lt__")(left, right)

def le(self, left: IndexOpsLike, right: Any) -> SeriesOrIndex:
from pyspark.pandas.base import column_op

_sanitize_list_like(right)
return column_op(Column.__le__)(left, right)
return pyspark_column_op("__le__")(left, right)

def ge(self, left: IndexOpsLike, right: Any) -> SeriesOrIndex:
from pyspark.pandas.base import column_op

_sanitize_list_like(right)
return column_op(Column.__ge__)(left, right)
return pyspark_column_op("__ge__")(left, right)

def gt(self, left: IndexOpsLike, right: Any) -> SeriesOrIndex:
from pyspark.pandas.base import column_op

_sanitize_list_like(right)
return column_op(Column.__gt__)(left, right)
return pyspark_column_op("__gt__")(left, right)

def prepare(self, col: pd.Series) -> pd.Series:
"""Prepare column when from_pandas."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@ def psdf(self):
def test_astype(self):
super().test_astype()

@unittest.skip("TODO(SPARK-43676): Fix DatetimeOps.ge to work with Spark Connect Column.")
def test_ge(self):
super().test_ge()

@unittest.skip("TODO(SPARK-43677): Fix DatetimeOps.gt to work with Spark Connect Column.")
def test_gt(self):
super().test_gt()

@unittest.skip("TODO(SPARK-43678): Fix DatetimeOps.le to work with Spark Connect Column.")
def test_le(self):
super().test_le()

@unittest.skip("TODO(SPARK-43679): Fix DatetimeOps.lt to work with Spark Connect Column.")
def test_lt(self):
super().test_lt()


if __name__ == "__main__":
from pyspark.pandas.tests.connect.data_type_ops.test_parity_datetime_ops import * # noqa: F401
Expand Down