Skip to content

Conversation

@sfc-gh-yixie
Copy link
Collaborator

@sfc-gh-yixie sfc-gh-yixie commented Oct 22, 2025

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

    Fixes SNOW-2203826

  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.
    Snowpark currently is very strict in flattening the filter and sort clause when generating a query. For instance df.select(col("c").alias("c1"), pow(2, "c").alias("d")).filter(col("c") > col("d")) doesn't work because the filter part is for a subquery, which is for the part df.select(col("c").alias("c1"), pow(2, "c").alias("d")). So the filter doesn't work because the subquery doesn't have column c. If the query is flattened, then column c can be used to filter.
    sort is in a similar situation though different. This PR is to loosening the rules to flatten more cases while maintaining the correct logic.

@sfc-gh-yixie sfc-gh-yixie marked this pull request as ready for review October 28, 2025 06:48
@sfc-gh-yixie sfc-gh-yixie requested review from a team as code owners October 28, 2025 06:48
@github-actions github-actions bot added the local testing Local Testing issues/PRs label Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

local testing Local Testing issues/PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants