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-1636678 add server side param for complexity bounds #2273

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-1636678

  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 makes the following changes:

    1. Read default values for complexity score bounds from session parameters. These bounds are used in large query breakdown optimization.
    2. Allow users to easily change the bounds using session object.
    3. Send telemetry about updates made to bounds by the user.

@sfc-gh-aalam sfc-gh-aalam added NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md labels Sep 11, 2024
@sfc-gh-aalam sfc-gh-aalam marked this pull request as ready for review September 11, 2024 22:56
@sfc-gh-aalam sfc-gh-aalam requested a review from a team as a code owner September 11, 2024 22:56
)
# The complexity score lower bound is set to match COMPILATION_MEMORY_LIMIT
# in Snowflake. This is the limit where we start seeing compilation errors.
DEFAULT_COMPLEXITY_SCORE_LOWER_BOUND = 10_000_000
Copy link
Contributor

@sfc-gh-helmeleegy sfc-gh-helmeleegy Sep 12, 2024

Choose a reason for hiding this comment

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

I'm assuming the compilation memory limit is measured in bytes? Can we also assume that our complexity score is measured in bytes? Wasn't it more based on the number of plan nodes?

If they don't use the same units, then is there a mapping between such units that we use?

"PYTHON_SNOWPARK_LARGE_QUERY_BREAKDOWN_COMPLEXITY_LOWER_BOUND"
)
# The complexity score lower bound is set to match COMPILATION_MEMORY_LIMIT
# in Snowflake. This is the limit where we start seeing compilation errors.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know if this is a soft limit or a hard limit? IoW, does the compiler intentionally errors out as soon as the limit is exceeded, or does it keep going anyway with undefined behavior?

)
# The complexity score lower bound is set to match COMPILATION_MEMORY_LIMIT
# in Snowflake. This is the limit where we start seeing compilation errors.
DEFAULT_COMPLEXITY_SCORE_LOWER_BOUND = 10_000_000
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also assuming that this limit is configurable on the compiler side. Is there a way to pull the currently configured value instead of hard coding it here - to make sure the two configurations are in sync?

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.

left a comment

@@ -784,6 +810,24 @@ def large_query_breakdown_enabled(self, value: bool) -> None:
"value for large_query_breakdown_enabled must be True or False!"
)

@large_query_breakdown_complexity_bounds.setter
def large_query_breakdown_complexity_bounds(self, value: Tuple[int, int]) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

might be easier to take a lower and upper bound there, then you can reconstruct the tuple internally, and we can make lower or upper optional also

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-yzou this is a @setter method. I'm afraid we have to abide by this format.

@sfc-gh-aalam sfc-gh-aalam enabled auto-merge (squash) September 13, 2024 21:41
@sfc-gh-aalam sfc-gh-aalam merged commit 08ff293 into main Sep 13, 2024
36 checks passed
@sfc-gh-aalam sfc-gh-aalam deleted the aalam-SNOW-1636678-add-server-side-param-for-complexity-bounds branch September 13, 2024 22:07
@github-actions github-actions bot locked and limited conversation to collaborators Sep 13, 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.

4 participants