SNOW-3266242: Support TRY_CAST with user-provided schema in DataFrameReader#4138
Open
sfc-gh-yuwang wants to merge 4 commits intomainfrom
Open
SNOW-3266242: Support TRY_CAST with user-provided schema in DataFrameReader#4138sfc-gh-yuwang wants to merge 4 commits intomainfrom
sfc-gh-yuwang wants to merge 4 commits intomainfrom
Conversation
| self._file_type = "CSV" | ||
|
|
||
| schema_to_cast, transformations = None, None | ||
| use_user_schema = False |
Contributor
There was a problem hiding this comment.
why we need to introduce this new var?
was there a bug before?
Collaborator
Author
There was a problem hiding this comment.
technically there is a bug before,
in the analyzer: https://github.com/snowflakedb/snowpark-python/blob/main/src/snowflake/snowpark/_internal/analyzer/snowflake_plan.py#L1960
we need this bool value to actually apply try_cast to the result, otherwise try_cast is ignored
| schema, | ||
| schema_to_cast, | ||
| transformations, | ||
| ) = self._get_schema_from_csv_user_input( |
Contributor
There was a problem hiding this comment.
can you check with @sfc-gh-skumbham to understand the scope? is this requirement just for csv?
do we need generalization for other formats?
Collaborator
Author
There was a problem hiding this comment.
I have confirmed with him that this PR's scope is limited to CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-3266242
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
preiously try_cast is not supported when using user schema, this PR meant to fix this gap