LukaZdravic commented on code in PR #59001:
URL: https://github.com/apache/spark/pull/59001#discussion_r4094732566


##########
sql/core/src/test/resources/sql-tests/inputs/join-asof-grammar.sql:
##########
@@ -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);

Review Comment:
   When ANSI is off, AS gets treated as an alias to the table because it's a 
non-reserved word, and that means 
   `FROM trades AS ASOF JOIN quotes USING (symbol)` this fails because it's an 
asof join
   
   `FROM trades AS ASOF JOIN quotes MATCH_CONDITION  (trades.trade_time >= 
quotes.quote_time) USING(symbol)` this fails because it expects the AS to be an 
alias, so no trades.trade_time allowed
   
   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?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to