Skip to content

SNOW-1876115: Allow column to cast to StructType.#2864

Merged
sfc-gh-yuwang merged 9 commits intomainfrom
SNOW-1876115
Jan 21, 2025
Merged

SNOW-1876115: Allow column to cast to StructType.#2864
sfc-gh-yuwang merged 9 commits intomainfrom
SNOW-1876115

Conversation

@sfc-gh-yuwang
Copy link
Collaborator

@sfc-gh-yuwang sfc-gh-yuwang commented Jan 14, 2025

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

    Fixes SNOW-1876115

  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.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
  3. Please describe how your code solves the related issue.

    Allow column to cast to StructType. Edited generated SQL so that it can rename and add structtype.

We currently do not support RENAME FIELDS or ADD FIELDS in CAST statement and thats why example code in description fail. As I am trying this parameter, RENAME FIELDS only works for structured object and requires them to have the exact same number of fields.
in snowpark design, column is a isolated object that does not have the context of analyzer or the whole generated SQL, which means inside the column we can not know the datatype of it, let alone whether it have exact same number of fields as the datatype it is casting to.
To workaround this, I’ll add parameters in .cast().

please to refer to jira tickets for more detail

@github-actions github-actions bot added the local testing Local Testing issues/PRs label Jan 14, 2025
@sfc-gh-yuwang sfc-gh-yuwang marked this pull request as ready for review January 15, 2025 22:51
@sfc-gh-yuwang sfc-gh-yuwang requested review from a team as code owners January 15, 2025 22:51
@sfc-gh-yuwang sfc-gh-yuwang merged commit 0ff01c4 into main Jan 21, 2025
48 of 52 checks passed
@sfc-gh-yuwang sfc-gh-yuwang deleted the SNOW-1876115 branch January 21, 2025 21:15
@github-actions github-actions bot locked and limited conversation to collaborators Jan 21, 2025
@sfc-gh-yuwang sfc-gh-yuwang restored the SNOW-1876115 branch February 13, 2025 22:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

local testing Local Testing issues/PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants