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

[MINOR][PYTHON][DOCS] Fix the type hint for extract, date_part and datepart #48613

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/pyspark/sql/connect/functions/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3190,21 +3190,21 @@ def dayname(col: "ColumnOrName") -> Column:
dayname.__doc__ = pysparkfuncs.dayname.__doc__


def extract(field: "ColumnOrName", source: "ColumnOrName") -> Column:
def extract(field: Column, source: "ColumnOrName") -> Column:
return _invoke_function_over_columns("extract", field, source)


extract.__doc__ = pysparkfuncs.extract.__doc__


def date_part(field: "ColumnOrName", source: "ColumnOrName") -> Column:
def date_part(field: Column, source: "ColumnOrName") -> Column:
return _invoke_function_over_columns("date_part", field, source)


extract.__doc__ = pysparkfuncs.extract.__doc__


def datepart(field: "ColumnOrName", source: "ColumnOrName") -> Column:
def datepart(field: Column, source: "ColumnOrName") -> Column:
return _invoke_function_over_columns("datepart", field, source)


Expand Down
12 changes: 6 additions & 6 deletions python/pyspark/sql/functions/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8564,15 +8564,15 @@ def dayname(col: "ColumnOrName") -> Column:


@_try_remote_functions
def extract(field: "ColumnOrName", source: "ColumnOrName") -> Column:
def extract(field: Column, source: "ColumnOrName") -> Column:
"""
Extracts a part of the date/timestamp or interval source.

.. versionadded:: 3.5.0

Parameters
----------
field : :class:`~pyspark.sql.Column` or str
field : :class:`~pyspark.sql.Column`
selects which part of the source should be extracted.
source : :class:`~pyspark.sql.Column` or str
a date/timestamp or interval column from where `field` should be extracted.
Expand Down Expand Up @@ -8600,15 +8600,15 @@ def extract(field: "ColumnOrName", source: "ColumnOrName") -> Column:


@_try_remote_functions
def date_part(field: "ColumnOrName", source: "ColumnOrName") -> Column:
def date_part(field: Column, source: "ColumnOrName") -> Column:
"""
Extracts a part of the date/timestamp or interval source.

.. versionadded:: 3.5.0

Parameters
----------
field : :class:`~pyspark.sql.Column` or str
field : :class:`~pyspark.sql.Column`
selects which part of the source should be extracted, and supported string values
are as same as the fields of the equivalent function `extract`.
source : :class:`~pyspark.sql.Column` or str
Expand Down Expand Up @@ -8637,15 +8637,15 @@ def date_part(field: "ColumnOrName", source: "ColumnOrName") -> Column:


@_try_remote_functions
def datepart(field: "ColumnOrName", source: "ColumnOrName") -> Column:
def datepart(field: Column, source: "ColumnOrName") -> Column:
"""
Extracts a part of the date/timestamp or interval source.

.. versionadded:: 3.5.0

Parameters
----------
field : :class:`~pyspark.sql.Column` or str
field : :class:`~pyspark.sql.Column`
selects which part of the source should be extracted, and supported string values
are as same as the fields of the equivalent function `extract`.
source : :class:`~pyspark.sql.Column` or str
Expand Down