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-1632701: Add uuid to SnowflakePlan #2233

Merged

Conversation

sfc-gh-aalam
Copy link
Contributor

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

    Fixes SNOW-1632701

  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.

    Associate a uuid with each SnowflakePlan so that we can track all queries that originated from the same plan.

@sfc-gh-aalam sfc-gh-aalam added the NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md label Sep 4, 2024
@sfc-gh-aalam sfc-gh-aalam marked this pull request as ready for review September 4, 2024 20:25
@sfc-gh-aalam sfc-gh-aalam requested a review from a team as a code owner September 4, 2024 20:25
@@ -260,6 +260,7 @@ def __init__(
referenced_ctes.copy() if referenced_ctes else set()
)
self._cumulative_node_complexity: Optional[Dict[PlanNodeCategory, int]] = None
self._uuid = str(uuid.uuid4())
Copy link
Collaborator

Choose a reason for hiding this comment

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

so there is very embracing state here that the snowflake_plan its-self already have and self._id fields, and used as part of the eq comparison, the id is generated based on the query and params, which may not be the exact indicator of whether two plan are the same plan.
I think we can keep both, but let's make sure we we doc it clearly here about the difference. @sfc-gh-jdu i also start question is changing the eq and hash correct in this case? I got the point that we want to simplify the comparison, but that also kind of changes the meaning of the equivalence of two snowflake plan nodes here.

return self._uuid

@uuid.setter
def uuid(self, value: str) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

i don't think we should provide a setter function here, i don't think anyone is suppose to change this once produced.

@@ -502,6 +511,7 @@ def __deepcopy__(self, memodict={}) -> "SnowflakePlan": # noqa: B006
copied_plan._is_valid_for_replacement = True
if copied_source_plan:
copied_source_plan._is_valid_for_replacement = True
copied_plan.uuid = self.uuid
Copy link
Collaborator

Choose a reason for hiding this comment

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

by definition, the copied_plan should have a different uuid here, right? because it is a different node

@sfc-gh-aalam sfc-gh-aalam merged commit 64e433d into main Sep 6, 2024
34 checks passed
@sfc-gh-aalam sfc-gh-aalam deleted the aalam-SNOW-1632701-add-a-plan-id-to-statement-params branch September 6, 2024 21:48
@github-actions github-actions bot locked and limited conversation to collaborators Sep 6, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants