Skip to content

SNOW-2895675: removing redundant alias when join#4044

Closed
sfc-gh-aling wants to merge 8 commits intomainfrom
aling-test-removing-alias
Closed

SNOW-2895675: removing redundant alias when join#4044
sfc-gh-aling wants to merge 8 commits intomainfrom
aling-test-removing-alias

Conversation

@sfc-gh-aling
Copy link
Copy Markdown
Contributor

@sfc-gh-aling sfc-gh-aling commented Jan 6, 2026

  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.

when performing dataframe join, snowpark generates redundant alias when there is no conflicting column
example:

session.create_dataframe([(1,2,3,4)], schema=["a", "b", "c", "d"]).write.save_as_table(table_name="temptable1", table_type="temporary")
session.create_dataframe([(5,6,7,8)], schema=["e", "f", "g", "h"]).write.save_as_table(table_name="temptable2", table_type="temporary")

df1 = session.table("temptable1")
df2 = session.table("temptable2")
dfm = df1.join(df2)
dfm.explain()
"""

before

SELECT  * 
 FROM (
(
 SELECT 
    "A" AS "A", 
    "B" AS "B", 
    "C" AS "C", 
    "D" AS "D"
 FROM temptable1
) AS SNOWPARK_LEFT 
INNER JOIN 
(
 SELECT 
    "E" AS "E", 
    "F" AS "F", 
    "G" AS "G", 
    "H" AS "H"
 FROM temptable2
) AS SNOWPARK_RIGHT

)

after

SELECT  * 
 FROM (
(
 SELECT  *  FROM temptable1
) AS SNOWPARK_LEFT 
INNER JOIN 
(
 SELECT  *  FROM temptable2
) AS SNOWPARK_RIGHT

)

@github-actions github-actions Bot added the local testing Local Testing issues/PRs label Jan 6, 2026
@sfc-gh-aling sfc-gh-aling force-pushed the aling-test-removing-alias branch from 2658966 to c5aaa11 Compare January 6, 2026 22:23
Comment thread src/snowflake/snowpark/dataframe.py Outdated
@sfc-gh-aling sfc-gh-aling changed the title try removing redundant alias SNOW-2895675: removing redundant alias when join Jan 6, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 6, 2026
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.

1 participant