Skip to content

NO-SNOW: fix type check before AST in sort()#3982

Merged
sfc-gh-mayliu merged 3 commits intomainfrom
NO-SNOW-fix-sort-AST-type-check
Nov 1, 2025
Merged

NO-SNOW: fix type check before AST in sort()#3982
sfc-gh-mayliu merged 3 commits intomainfrom
NO-SNOW-fix-sort-AST-type-check

Conversation

@sfc-gh-mayliu
Copy link
Collaborator

@sfc-gh-mayliu sfc-gh-mayliu commented Oct 30, 2025

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

    Fixes SNOW-NNNNNNN

  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
    • If adding any arguments to public Snowpark APIs or creating new public Snowpark APIs, I acknowledge that I have ensured my changes include AST support. Follow the link for more information: AST Support Guidelines
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.

Impacted AST test job: https://github.com/snowflakedb/snowpark-python/actions/runs/18924709047/job/54029335118?pr=3971

[gw1] linux -- Python 3.13.7 /home/runner/work/snowpark-python/snowpark-python/.tox/py313-notudfdoctest-ci/bin/python3
tests/integ/test_df_sort.py:71: in test_sort_invalid_inputs
    assert (
E   assert 'sort() only accepts str and Column objects, or a list containing str and Column objects' in '<ExceptionInfo TypeError("<class \'list\'> is not a valid type for Column or column name AST.") tblen=5>'
E    +  where '<ExceptionInfo TypeError("<class \'list\'> is not a valid type for Column or column name AST.") tblen=5>' = str(<ExceptionInfo TypeError("<class 'list'> is not a valid type for Column or column name AST.") tblen=5>)

Root cause is that type checking for sort(...*cols) occurs later than AST expr parsing and thus impacts AST before TypeError is thrown.

@sfc-gh-mayliu sfc-gh-mayliu requested review from a team as code owners October 30, 2025 22:49
@sfc-gh-mayliu sfc-gh-mayliu added the NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md label Oct 30, 2025
@sfc-gh-mayliu sfc-gh-mayliu force-pushed the NO-SNOW-fix-sort-AST-type-check branch from 93d692d to aebd635 Compare October 31, 2025 20:46
@sfc-gh-mayliu sfc-gh-mayliu merged commit 324a130 into main Nov 1, 2025
46 of 48 checks passed
@sfc-gh-mayliu sfc-gh-mayliu deleted the NO-SNOW-fix-sort-AST-type-check branch November 1, 2025 02:37
@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2025
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.

3 participants