Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Snowflake homonyms should be resolved before dealiasing #1283

Open
1 task done
ericvergnaud opened this issue Dec 5, 2024 · 0 comments
Open
1 task done

[BUG]: Snowflake homonyms should be resolved before dealiasing #1283

ericvergnaud opened this issue Dec 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ericvergnaud
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Category of Bug / Issue

TranspileLateralColumnAliasError

Current Behavior

Our current implementation of SnowFlake LCAs assumes that homonym aliases have priority over columns, which might not be the case.
Consider for example the following:
SELECT substr(ca_zip, 1, 5) as ca_zip FROM ca WHERE ca_zip in ('12345', '23456')
It's unclear whether the ca_zip in the WHERE clause should resolve to the ca_zip column, or the ca_zip alias (which translates to a substr expression).
Morevover, consider the following:
SELECT substr(some_code, 1, 5) as ca_zip FROM ca WHERE ca_zip in ('12345', '23456')
If a ca_zip column exists, even though not referenced in the query, then SnowFlake might resolve the ca_zip in the WHERE clause to that column rather than the alias.

See #1242 for examples of the current dealiasing logic.

We need to specify the expected behavior accurately and potentially fix our implementation.

Expected Behavior

Dealias following SnowFlake logic

Steps To Reproduce

No response

Relevant log output or Exception details

No response

Sample Query

No response

Operating System

macOS

Version

latest via Databricks CLI

@ericvergnaud ericvergnaud added the bug Something isn't working label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant