-
Notifications
You must be signed in to change notification settings - Fork 29.4k
[SPARK-59628][SQL] Reject ASOF JOIN without MATCH_CONDITION instead of a silent plain join #59001
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,6 +128,9 @@ SELECT * FROM trades t LEFT SEMI ASOF JOIN quotes q | |
| -- FVT-ASOF-1-017: missing MATCH_CONDITION | ||
| SELECT * FROM trades t ASOF JOIN quotes q ON t.symbol = q.symbol; | ||
|
|
||
| -- FVT-ASOF-1-020: missing MATCH_CONDITION with no left alias is rejected, not a plain join | ||
| SELECT * FROM trades ASOF JOIN quotes USING (symbol); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When ANSI is off, AS gets treated as an alias to the table because it's a non-reserved word, and that means
When ANSI is on, AS is a reserved word so every attempt at writing AS ASOF is failing. I should add goldens so we solidify this behaviour for someone else who may come in contact with this, what do you think? |
||
|
|
||
| -- FVT-ASOF-1-018: multiple comparisons in MATCH_CONDITION | ||
| SELECT * FROM trades t ASOF JOIN quotes q | ||
| MATCH_CONDITION (t.trade_time >= q.quote_time AND t.symbol = q.symbol) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ANSI mode should probably match SQL-2016, like in ANTI case
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASOF cannot be non-reserved, because it can then be read as a table alias, same as the
ASwe talked about above. However ANTI that you mention has the same problemSELECT * FROM t ANTI JOIN u USING (k)this return the inner join rows not the anti join rows. Definitely worth a follow up, what do you think? Also probably an investigation as to what else can be written normally and have different behaviours