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-1487311: Fix test failures and lint issues with numpy 2 #1791

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

sfc-gh-joshi
Copy link
Contributor

@sfc-gh-joshi sfc-gh-joshi commented Jun 17, 2024

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

    Fixes SNOW-1487311

  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.

This PR fixes issues that are raised from the lint environment resolving numpy to 2.0.0. This does not mean Snowpark pandas supports numpy 2.0.0 (though Snowpark Python + local testing should); this PR just makes non-impactful code changes to pass lint and make code consistent.

Notably, numpy 2.0.0 removes np.float_ in favor of np.float64, and np.NaN in favor of np.nan.

@sfc-gh-joshi sfc-gh-joshi requested a review from a team as a code owner June 17, 2024 20:33
@sfc-gh-joshi sfc-gh-joshi requested a review from a team as a code owner June 17, 2024 20:51
@sfc-gh-joshi sfc-gh-joshi changed the title SNOW-1487311: Fix snowpark pandas lint issues with numpy 2 SNOW-1487311: Fix test failures and lint issues with numpy 2 Jun 17, 2024
@github-actions github-actions bot added the local testing Local Testing issues/PRs label Jun 17, 2024
@sfc-gh-joshi sfc-gh-joshi added NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md NO-PANDAS-CHANGEDOC-UPDATES This PR does not update Snowpark pandas docs labels Jun 17, 2024
@@ -92,7 +92,6 @@
(np.half, FloatType()),
(np.float16, FloatType()),
(np.float64, DoubleType()),
(np.float_, DoubleType()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, we actually removed np.float_, i thought he message says it is replaced with np.float?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

np.float_ is an alias for np.float64 after numpy 2.x (https://numpy.org/doc/stable/release/2.0.0-notes.html#numpy-2-0-python-api-removals). We specified float64 already in the line right above this.

Older documentation (https://numpy.org/doc/1.26/reference/arrays.scalars.html#numpy.float_) refers to it as an alias of double, so I don't think this would cause any behavioral differences.

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.

LGTM

Copy link
Collaborator

@sfc-gh-yzou sfc-gh-yzou left a comment

Choose a reason for hiding this comment

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

@sfc-gh-joshi let's revert @sfc-gh-azhan 's workaround here ee410eb.
also, let's add some backward compatibility testing. Thanks!

@sfc-gh-joshi sfc-gh-joshi force-pushed the joshi-SNOW-1487311-np-lint branch from 3d942b7 to 97c03dc Compare June 18, 2024 06:03
@sfc-gh-joshi
Copy link
Contributor Author

@sfc-gh-yzou Reverted, I'll add the extra tests we discussed on slack in a followup PR.

@sfc-gh-joshi sfc-gh-joshi enabled auto-merge (squash) June 18, 2024 06:04
@sfc-gh-joshi sfc-gh-joshi merged commit e076031 into main Jun 18, 2024
37 checks passed
@sfc-gh-joshi sfc-gh-joshi deleted the joshi-SNOW-1487311-np-lint branch June 18, 2024 06:31
@github-actions github-actions bot locked and limited conversation to collaborators Jun 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
local testing Local Testing issues/PRs NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md 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.

5 participants