Skip to content

Commit

Permalink
Revert trunc(date, format).
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyum committed Aug 2, 2017
1 parent 3d40c36 commit 931f07d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/pyspark/sql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,12 +1028,12 @@ def to_timestamp(col, format=None):


@since(1.5)
def trunc(data, truncParam):
def trunc(date, format):
"""
Returns date truncated to the unit specified by the truncParam or
Returns date truncated to the unit specified by the format or
numeric truncated by specified decimal places.
:param truncParam: 'year', 'YYYY', 'yy' or 'month', 'mon', 'mm' for date
:param format: 'year', 'YYYY', 'yy' or 'month', 'mon', 'mm' for date
and any int for numeric.
>>> df = spark.createDataFrame([('1997-02-28',)], ['d'])
Expand All @@ -1050,7 +1050,7 @@ def trunc(data, truncParam):
[Row(zero=1234567891.0)]
"""
sc = SparkContext._active_spark_context
return Column(sc._jvm.functions.trunc(_to_java_column(data), truncParam))
return Column(sc._jvm.functions.trunc(_to_java_column(date), format))


@since(1.5)
Expand Down

0 comments on commit 931f07d

Please sign in to comment.