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-1105953 Fix Local Testing implementation of count_distinct #1304

Merged
merged 4 commits into from
Mar 13, 2024

Conversation

sfc-gh-stan
Copy link
Collaborator

@sfc-gh-stan sfc-gh-stan commented Mar 12, 2024

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-1105953: count_distinct mock in local testing does not work correctly #1268 /SNOW-1105953

  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.

    Issue: The previous implementation does not work with pandas dataframe's row indexing. On Line 224, dict_data could already have a row indexing that's not a consecutive integer sequence starting from 0, so temp_table is not initialized correctly.

    PR: This PR implements count_distinct by merging all incoming columns into a column of tuples, then applying pandas.DataFrame.nunique.

Copy link
Contributor

@sfc-gh-jrose sfc-gh-jrose left a comment

Choose a reason for hiding this comment

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

Looks good to me.

tests/integ/scala/test_dataframe_aggregate_suite.py Outdated Show resolved Hide resolved
@sfc-gh-stan sfc-gh-stan enabled auto-merge (squash) March 12, 2024 23:08
@sfc-gh-stan sfc-gh-stan merged commit e695d3b into main Mar 13, 2024
60 of 61 checks passed
@sfc-gh-stan sfc-gh-stan deleted the fix-local-testing-count-distinct branch March 13, 2024 03:24
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2024
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.

SNOW-1105953: count_distinct mock in local testing does not work correctly
3 participants