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-1489960, SNOW-1491199] Snowpark python API client-side changes for IR encoding to protobuf #2674

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

sfc-gh-lspiegelberg
Copy link
Contributor

@sfc-gh-lspiegelberg sfc-gh-lspiegelberg commented Nov 25, 2024

Main commit for SNOW-1489960 bringing in changes to encode Snowpark python API to protobuf. A detailed commit history can be found in https://github.com/snowflakedb/snowpark-python/tree/ls-SNOW-1491199-merge-phase0-server-side.

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

    Please write a short description of how your code change solves the related issue.

Co-authored-by: Arthur Zwiegincew [email protected]
Co-authored-by: Ovidiu Platon [email protected]
Co-authored-by: Hemit Shah [email protected]
Co-authored-by: Varnika Budati [email protected]
Co-authored-by: Eric Vandenberg [email protected]
Co-authored-by: Andong Zhan [email protected]

@github-actions github-actions bot added local testing Local Testing issues/PRs snowpark-pandas labels Nov 25, 2024
@sfc-gh-lspiegelberg sfc-gh-lspiegelberg added the NO-PANDAS-CHANGEDOC-UPDATES This PR does not update Snowpark pandas docs label Nov 25, 2024
@@ -81,6 +81,8 @@ passenv =
SF_REGRESS_LOGS
; Github Actions provided environmental variables
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sfc-gh-azhan this here changed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

duplicate lines in 84 85

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To resolve what should I do? I think both are here because of windows/ubuntu differences.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

leaving for now as is, we can do follow up PR to resolve/improve.

Copy link
Collaborator

Choose a reason for hiding this comment

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

why? Such a simple change

Copy link
Collaborator

Choose a reason for hiding this comment

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

you just need to move line 84 and 85.

setup.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
src/conftest.py Outdated Show resolved Hide resolved
@sfc-gh-lspiegelberg sfc-gh-lspiegelberg changed the title [DRAFT] squash merge staging branch changes SNOW-1489960 Snowpark python API client-side changes for IR encoding to protobuf Nov 25, 2024
@sfc-gh-lspiegelberg sfc-gh-lspiegelberg changed the title SNOW-1489960 Snowpark python API client-side changes for IR encoding to protobuf [SNOW-1489960, SNOW-1491199] Snowpark python API client-side changes for IR encoding to protobuf Nov 25, 2024
@@ -19,6 +19,7 @@
- `keyType`: keys of the map
- `valueType`: values of the map
- Added support for `include_nulls` argument in `DataFrame.unpivot`.
- Added client-side thin-client mode which can be enabled with `session.ast_enabled=True` (default: `False`).
Copy link
Collaborator

Choose a reason for hiding this comment

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

enable ast does not enable a thin client mode right? We still send sql query to the server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

change to
Added parameter ast_enabled to session for internal usage (default: False)

def __init__(
self,
session: "snowflake.snowpark.session.Session",
include_failures: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

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

add comment to talk about what include_failures does

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sfc-gh-oplaton can we add a comment here?

self._session._ast_batch.eval(repr)

# Flush the AST and encode it as part of the query.
_, kwargs["_dataframe_ast"] = self._session._ast_batch.flush()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we create a constant for "_dataframe_ast"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add DATAFRAME_AST_PARAMETER="_dataframe_ast"

@@ -1 +1,2 @@
parameters*.py
cassettes/
Copy link
Collaborator

Choose a reason for hiding this comment

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

curious what code generate this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove this.

]


def _process_response_recording(response):
Copy link
Collaborator

Choose a reason for hiding this comment

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

where do we use _process_response_recording?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove this. double-check this file.

@@ -597,7 +597,7 @@ def test_to_datetime_pydatetime(self):
@pytest.mark.parametrize(
"dt", [np.datetime64("2000-01-01"), np.datetime64("2000-01-02")]
)
@sql_count_checker(query_count=1)
@sql_count_checker(query_count=1, join_count=0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't change this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

revert this change.

@sfc-gh-lspiegelberg
Copy link
Contributor Author

Add coverage to AST gates

      - name: Combine coverages
        run: python -m tox -e coverage --skip-missing-interpreters false
        shell: bash
        env:
          SNOWFLAKE_IS_PYTHON_RUNTIME_TEST: 1
      - uses: actions/upload-artifact@v4
        with:
          include-hidden-files: true
          name: coverage_${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
          path: |
            .tox/.coverage
            .tox/coverage.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
local testing Local Testing issues/PRs 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