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

Unify Snowflake object name handling in the Snowpark AST #2789

Merged
merged 16 commits into from
Jan 6, 2025

Conversation

sfc-gh-oplaton
Copy link
Contributor

@sfc-gh-oplaton sfc-gh-oplaton commented Dec 19, 2024

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

    Fixes SNOW-1621205

  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.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
  3. Please describe how your code solves the related issue.

This is the client-side change corresponding to https://github.com/snowflakedb/snowflake/pull/240557

Unify Snowflake object name handling in the Snowpark AST.
Remove FnName and SpTableName. They both had Flat and Structured variants, but ultimately designate Snowflake object names.
Introduce data SpName and entity SpNameRef for referring to Snowflake objects by relative or fully qualified name.
Update FnNameRefExpr.
Use SpNameRef in a few places that used to use List[String].

@sfc-gh-oplaton sfc-gh-oplaton 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 Dec 19, 2024
@sfc-gh-oplaton sfc-gh-oplaton marked this pull request as ready for review December 21, 2024 01:18
@sfc-gh-oplaton sfc-gh-oplaton requested review from a team as code owners December 21, 2024 01:18
@sfc-gh-oplaton sfc-gh-oplaton enabled auto-merge (squash) December 21, 2024 01:18
@sfc-gh-oplaton sfc-gh-oplaton changed the title Introduce a uniform ObjectName trait for referring to Snowflake objects Unify Snowflake object name handling in the Snowpark AST Dec 21, 2024
expr_builder.sp_table_name_structured.name.extend(name)
else:
raise ValueError(f"Invalid name type {type(name)} for SpTableName entity.")
def build_sp_table_name(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these type-specific functions necessary? One thing I notice is that the re-emitted exceptions lose the diagnostic contents of the original exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing I notice is that the re-emitted exceptions lose the diagnostic contents of the original exception.

That's weird, raise ... from ... should preserve the contents. The functions aren't strictly necessary, but I find the call sites more readable (the name clarifies the intent), and the errors should have been more readable, too.

Copy link
Collaborator

@sfc-gh-evandenberg sfc-gh-evandenberg left a comment

Choose a reason for hiding this comment

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

LGTM

@sfc-gh-oplaton sfc-gh-oplaton merged commit 3a8612f into main Jan 6, 2025
42 checks passed
@sfc-gh-oplaton sfc-gh-oplaton deleted the oplaton/snow-1621205-object-name branch January 6, 2025 22:10
@github-actions github-actions bot locked and limited conversation to collaborators Jan 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants