Skip to content

Commit 81ef113

Browse files
committed
[SPARK-43710][PS][FOLLOWUP] Fix date_part invocations
### What changes were proposed in this pull request? fix bc20e85: 1, should use `F.lit("HOUR")` as the parameter; 2, should also change `def microseconds` since the old function was removed; ### Why are the changes needed? to fix wrong usage ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? existing UT Closes #41911 from zhengruifeng/spark_43710_followup. Authored-by: Ruifeng Zheng <[email protected]> Signed-off-by: Ruifeng Zheng <[email protected]>
1 parent 4bec311 commit 81ef113

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

python/pyspark/pandas/indexes/timedelta.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from pyspark.pandas.indexes.base import Index
2626
from pyspark.pandas.missing.indexes import MissingPandasLikeTimedeltaIndex
2727
from pyspark.pandas.series import Series
28-
from pyspark.pandas.spark import functions as SF
2928
from pyspark.sql import functions as F
3029

3130

@@ -150,9 +149,9 @@ def seconds(self) -> Index:
150149

151150
@no_type_check
152151
def get_seconds(scol):
153-
hour_scol = F.date_part("HOUR", scol)
154-
minute_scol = F.date_part("MINUTE", scol)
155-
second_scol = F.date_part("SECOND", scol)
152+
hour_scol = F.date_part(F.lit("HOUR"), scol)
153+
minute_scol = F.date_part(F.lit("MINUTE"), scol)
154+
second_scol = F.date_part(F.lit("SECOND"), scol)
156155
return (
157156
F.when(
158157
hour_scol < 0,
@@ -178,7 +177,7 @@ def microseconds(self) -> Index:
178177

179178
@no_type_check
180179
def get_microseconds(scol):
181-
second_scol = SF.date_part("SECOND", scol)
180+
second_scol = F.date_part(F.lit("SECOND"), scol)
182181
return (
183182
(
184183
F.when(

0 commit comments

Comments
 (0)