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-1016709: Add local testing support for STRIP_NULL_VALUE #1222

Merged
merged 8 commits into from
Feb 20, 2024

Conversation

sfc-gh-jrose
Copy link
Contributor

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 #1016709

  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.

    This PR adds local testing support for STRIP_NULL_VALUE.

    Question for reviewers:
    Is STRIP_NULL_VALUE always called with a value column or should it be able to walk a json object and replace all instances of 'null'?

CHANGELOG.md Outdated
@@ -16,6 +16,8 @@
- `array_except`
- `create_map`
- `sign`/`signum`
- Added support for the following local testing functions:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should move to a new release.

def mock_strip_null_value(expr: ColumnEmulator):
return ColumnEmulator(
[None if x == "null" else x for x in expr], sf_type=expr.sf_type
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like nullability could be different than the input column?

Copy link
Contributor

Choose a reason for hiding this comment

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

same question about the nullability of the ColumnType, is the current backend behavior always returning true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Experimentally it appears to always return a column that is nullable. I wonder if it would be useful to create a test that runs both the normal version and local testing version of a test and then ensures they return the same result.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Tests outside tests/mock that are marked with pytest.mark.localtest are run against both a live connection and a local testing connection.

@sfc-gh-jrose sfc-gh-jrose force-pushed the jrose_snow_1016709_add_STRIP_NULL_VALUE branch from 892295f to 32a0861 Compare February 1, 2024 20:52
CHANGELOG.md Outdated Show resolved Hide resolved
def mock_strip_null_value(expr: ColumnEmulator):
return ColumnEmulator(
[None if x == "null" else x for x in expr], sf_type=expr.sf_type
)
Copy link
Contributor

Choose a reason for hiding this comment

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

same question about the nullability of the ColumnType, is the current backend behavior always returning true?

tests/integ/scala/test_function_suite.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@sfc-gh-stan sfc-gh-stan left a comment

Choose a reason for hiding this comment

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

The code changes LGTM, please fix the changelog before merging.

@sfc-gh-jrose sfc-gh-jrose force-pushed the jrose_snow_1016709_add_STRIP_NULL_VALUE branch from 470950c to a3e34fc Compare February 20, 2024 17:14
@sfc-gh-jrose sfc-gh-jrose enabled auto-merge (squash) February 20, 2024 17:14
@sfc-gh-jrose sfc-gh-jrose merged commit 0e9fdc8 into main Feb 20, 2024
55 checks passed
@sfc-gh-jrose sfc-gh-jrose deleted the jrose_snow_1016709_add_STRIP_NULL_VALUE branch February 20, 2024 18:22
@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 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.

3 participants