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

SNOW-952961: Wrong documentation for daydiff function #1112

Closed
julienripoche opened this issue Oct 27, 2023 · 1 comment · Fixed by #1113
Closed

SNOW-952961: Wrong documentation for daydiff function #1112

julienripoche opened this issue Oct 27, 2023 · 1 comment · Fixed by #1113
Labels

Comments

@julienripoche
Copy link

def daydiff(col1: ColumnOrName, col2: ColumnOrName) -> Column:

The documentation of the daydiff function states that the result is the difference between col2 and col1.

"""Calculates the difference between two dates, or timestamp columns based in days.
The result will reflect the difference between col2 - col1
"""

Whereas it actually is the difference between col1 and col2.

"""
Example::
>>> from snowflake.snowpark.functions import daydiff, to_date
>>> df = session.createDataFrame([("2015-04-08", "2015-05-10")], ["d1", "d2"])
>>> res = df.select(daydiff(to_date(df.d2), to_date(df.d1)).alias("diff")).show()
----------
|"DIFF" |
----------
|32 |
----------

"""

I understand that this is the intended behaviour.

#730

So I ask that the documentation is updated in order to make the actual behaviour clear.

"""Calculates the difference between two dates, or timestamp columns based in days.
The result will reflect the difference between col1 - col2

Example::
>>> from snowflake.snowpark.functions import daydiff, to_date
>>> df = session.createDataFrame([("2015-04-08", "2015-05-10")], ["d1", "d2"])
>>> res = df.select(daydiff(to_date(df.d2), to_date(df.d1)).alias("diff")).show()
----------
|"DIFF" |
----------
|32 |
----------

"""

@julienripoche julienripoche added bug Something isn't working needs triage Initial RCA is required labels Oct 27, 2023
@github-actions github-actions bot changed the title Wrong documentation for daydiff function SNOW-952961: Wrong documentation for daydiff function Oct 27, 2023
@sfc-gh-aalam
Copy link
Contributor

Thanks for pointing this out @julienripoche

@sfc-gh-aalam sfc-gh-aalam added triaged and removed bug Something isn't working needs triage Initial RCA is required labels Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants