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-876999: Add support for timezone-aware type annotation on UDF #979

Merged
merged 2 commits into from
Jul 28, 2023

Conversation

sfc-gh-jdu
Copy link
Collaborator

Please answer these questions before submitting your pull requests. Thanks!

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-876999

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

    Previously we add support for timestamp variations in data types, but we also need such support for UDFs with type annotations.

@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Merging #979 (51312d1) into main (1836813) will decrease coverage by 0.01%.
Report is 3 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #979      +/-   ##
==========================================
- Coverage   98.35%   98.34%   -0.01%     
==========================================
  Files          51       51              
  Lines        9227     9298      +71     
  Branches     1671     1691      +20     
==========================================
+ Hits         9075     9144      +69     
- Misses         61       62       +1     
- Partials       91       92       +1     
Files Changed Coverage Δ
src/snowflake/snowpark/udf.py 97.40% <ø> (ø)
src/snowflake/snowpark/_internal/type_utils.py 98.20% <100.00%> (+0.05%) ⬆️
src/snowflake/snowpark/types.py 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@sfc-gh-sfan sfc-gh-sfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also address the comment about test coverage for default case :)

timezone = TimestampTimeZone.LTZ
elif tp_args[0] == TZ:
timezone = TimestampTimeZone.TZ
else:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: what can this else be? Or should we actually raise?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it can be Timestamp[int], which is invalid and we should raise an exception here, good catch! I added tests to cover these code path.

@sfc-gh-jdu sfc-gh-jdu merged commit dc1d496 into main Jul 28, 2023
40 of 41 checks passed
@sfc-gh-jdu sfc-gh-jdu deleted the jdu-SNOW-876999-timestamp branch July 28, 2023 21:39
@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants