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

Support for (+) outer join syntax #1145

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

jmhain
Copy link
Contributor

@jmhain jmhain commented Feb 22, 2024

Snowflake supports a peculiar alternative syntax for outer joins using the (+) operator. For example, the following two queries are logically equivalent:

SELECT t1.c1, t2.c2
FROM t1, t2
WHERE t1.c1 = t2.c2 (+);
SELECT t1.c1, t2.c2
FROM t1 LEFT OUTER JOIN t2
        ON t1.c1 = t2.c2;

This adds support to the parser for this syntax. I've only tested on Snowflake, but a web search suggested that MS SQL also supports this syntax, so I permitted it on that dialect as well.

@coveralls
Copy link

coveralls commented Feb 22, 2024

Pull Request Test Coverage Report for Build 8011843286

Details

  • 0 of 49 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 87.713%

Totals Coverage Status
Change from base Build 7915258585: 0.03%
Covered Lines: 19702
Relevant Lines: 22462

💛 - Coveralls

@jmhain jmhain force-pushed the joey/obfuscated-outer-join branch from 02173a8 to 8d484fa Compare February 22, 2024 22:29
@alamb
Copy link
Contributor

alamb commented Feb 28, 2024

Snowflake supports a peculiar alternative syntax for outer joins using the (+) operator. For example, the following two queries are logically equivalent:

I recognize that syntax from Oracle as well https://blogs.oracle.com/optimizer/post/outerjoins-in-oracle 👍

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me -- thank you very much @jmhain . The comments and tests are 💯

@alamb alamb changed the title snowflake: support for (+) outer join syntax Support for (+) outer join syntax Feb 28, 2024
@alamb alamb merged commit 6a9b6f5 into apache:main Feb 28, 2024
10 checks passed
@jmhain jmhain deleted the joey/obfuscated-outer-join branch February 29, 2024 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants