-
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
SNOW-1829870: Allow structured types to be enabled by default #2727
base: main
Are you sure you want to change the base?
Conversation
Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing |
Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing |
self.element_type = element_type | ||
else: |
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.
can element_type
be None
here? What does it mean for the column type to be so?
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 element_type is None than this is a semi-structured array column and could contain anything.
) | ||
value_type = ( | ||
python_type_to_snow_type(tp_args[1], is_return_type_of_sproc)[0] | ||
if tp_args | ||
else StringType() | ||
else None |
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.
is there an example to illustrate how the code change would work? I'm wondering changing StringType to None would cause any change in non-structured type cases
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.
See here:
snowpark-python/src/snowflake/snowpark/types.py
Lines 405 to 406 in 0dd7b91
self.key_type = key_type if key_type else StringType() | |
self.value_type = value_type if value_type else StringType() |
The
None
here passes responsibility to the type initializer which still defaults to StringType when dealing with non-structured cases.
) 1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR. Fixes SNOW-1852779 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. - [x] I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: [Thread-safe Developer Guidelines](https://github.com/snowflakedb/snowpark-python/blob/main/CONTRIBUTING.md#thread-safe-development) 3. Please describe how your code solves the related issue. Fixed AST encoding for Column `in_`, `asc`, and `desc`. Removed an unused entity and renamed `sp_column_in__seq` to `sp_column_in`. Changed the `nulls_first` optional boolean param to be an enum.
Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing |
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-1829870
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
This PR addresses a few misc issue involved with enabling structured types by default.
Before this change the in order to have a structured schema you would have to set the structured parameter to True on each type that was expected to be structured:
After this change the second case above will instead be inferred to be structured which should be more understandable to users. We've seen confusion in the past with the inner types being converted to StringType being non-inuitive.
After the change the definitions will look like this: