Luka Zdravic created SPARK-59628:
------------------------------------

             Summary: ASOF JOIN silently ignores a missing MATCH_CONDITION when 
the left table has no alias
                 Key: SPARK-59628
                 URL: https://issues.apache.org/jira/browse/SPARK-59628
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Luka Zdravic


MATCH_CONDITION is required for ASOF JOIN. When it is missing and the left 
table has no alias, the parser does not fail. It reads the ASOF keyword as the 
alias of the left table and builds a plain INNER JOIN. The query then runs and 
returns wrong results with no error. 
 

Repro:
  SELECT * FROM t ASOF JOIN u ON t.a = u.a;
  Parsed (unresolved) plan, no error:
    'Project [*]
    +- 'Join Inner, ('t.a = 'u.a)
       :- 'SubqueryAlias asof
       :  +- 'UnresolvedRelation [t]
       +- 'UnresolvedRelation [u]
  The ASOF keyword was consumed as the alias "asof" of table t.
  
Expected: fail with a clear error that MATCH_CONDITION is required for ASOF 
JOIN.

Umbrella: SPARK-59626



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to