-
Notifications
You must be signed in to change notification settings - Fork 117
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
Feedback on public api #2735
base: main
Are you sure you want to change the base?
Feedback on public api #2735
Conversation
# - check isinstance(session, snowflake.snowpark.Session) | ||
# - update kwargs["_emit_ast"] = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed we are not checking isinstance(session, Session)
in all branches so this would make it more consistent
return True # noqa: B012 | ||
# session has not been created yet, do not encode AST be default. | ||
# TODO: flip this to True when we go GA. | ||
return False # noqa: B012 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're moving away from hard-coded True
, the value should come from an environment variable, or some other suitable global configuration source. We don't want to be in a place where the feature is untestable while under development/opt-in mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would it not be testable if user has a session and they have oped-in such that session.ast_enabled
returns true.
We reach this case when a valid session is not found. Now, default to assuming that ast is enabled but I suggest we default to assuming it is disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much of the Snowpark public API surface is session-agnostic. Hard-coding this return value to False
breaks the following valid code:
avg_a = call_function("avg", col("a"))
with Session.builder.config(...).create() as session:
df = session.create_dataframe([1, 2, 3, 4], schema=["a"])
df.select(avg_a).show()
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-NNNNNNN
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.