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-1429199]: Provide clearer error message for groupby aggregations #2308

Merged
merged 9 commits into from
Sep 19, 2024

Conversation

sfc-gh-rdurrani
Copy link
Contributor

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

    Fixes SNOW-1429199

  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.
  3. Please describe how your code solves the related issue.

Ensure clearer error messages for groupby aggregations to help snowpark users.

@sfc-gh-rdurrani sfc-gh-rdurrani added the NO-PANDAS-CHANGEDOC-UPDATES This PR does not update Snowpark pandas docs label Sep 17, 2024
Copy link
Contributor

@sfc-gh-nkrishna sfc-gh-nkrishna left a comment

Choose a reason for hiding this comment

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

Approving, left one nit

src/snowflake/snowpark/modin/pandas/groupby.py Outdated Show resolved Hide resolved
tests/integ/modin/groupby/test_groupby_basic_agg.py Outdated Show resolved Hide resolved
@sfc-gh-rdurrani sfc-gh-rdurrani enabled auto-merge (squash) September 18, 2024 21:31
tests/integ/modin/groupby/test_groupby_basic_agg.py Outdated Show resolved Hide resolved
ValueError, match=re.escape('For argument "numeric_only" expected type bool')
ValueError,
match=re.escape(
"GroupBy aggregations like 'sum' take a 'numeric_only' argument that needs to be a bool, but a str value was passed in."
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need to parametrize by "numeric_only,type_name" since int and string have different names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch - but instead of adding extra parameter, I just updated the error message to be an f-string and use {type(numeric_only).name}, same as where the error message is thrown.

@sfc-gh-rdurrani sfc-gh-rdurrani merged commit fe1f392 into main Sep 19, 2024
35 checks passed
@sfc-gh-rdurrani sfc-gh-rdurrani deleted the rdurrani-SNOW-1429199 branch September 19, 2024 16:57
@github-actions github-actions bot locked and limited conversation to collaborators Sep 19, 2024
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.

3 participants