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-1331967: Improve error message for pandas APIs calling UDFs/UDTFs with Snowpark objects #3114

Merged

Conversation

sfc-gh-nkrishna
Copy link
Contributor

@sfc-gh-nkrishna sfc-gh-nkrishna commented Mar 4, 2025

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

    Fixes SNOW-1331967

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
  3. Please describe how your code solves the related issue.

UDFs/UDTFs do not work with Snowpark objects. This also applies to pandas methods like apply and map that use UDFs/UDTFs in their implementation. Users invoking these functions would receive a NotImplementedError that was hard to decipher: Snowpark pandas does not yet support the method DataFrame.__reduce__.

This PR catches that NotImplementedError returns a more user-friendly ValueError message and links to the documentation describing Snowpark pandas limitations when such a case is hit.

@sfc-gh-nkrishna sfc-gh-nkrishna requested a review from a team as a code owner March 4, 2025 19:13
@sfc-gh-nkrishna sfc-gh-nkrishna added the NO-PANDAS-CHANGEDOC-UPDATES This PR does not update Snowpark pandas docs label Mar 4, 2025
Copy link
Contributor

@sfc-gh-helmeleegy sfc-gh-helmeleegy left a comment

Choose a reason for hiding this comment

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

One nit, but looks good otherwise.

Copy link
Contributor

@sfc-gh-lmukhopadhyay sfc-gh-lmukhopadhyay left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@sfc-gh-jjiao sfc-gh-jjiao left a comment

Choose a reason for hiding this comment

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

Approved with a comment/reminder

@sfc-gh-nkrishna sfc-gh-nkrishna merged commit e3e067e into main Mar 5, 2025
36 of 40 checks passed
@sfc-gh-nkrishna sfc-gh-nkrishna deleted the nkrishna-SNOW-1331967-udf-snowpark-object-error branch March 5, 2025 06:09
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
NO-PANDAS-CHANGEDOC-UPDATES This PR does not update Snowpark pandas docs snowpark-pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants