Luka Zdravic created SPARK-62246:
------------------------------------

             Summary: DataFrame as-of join with using columns returns the key 
column of both sides
                 Key: SPARK-62246
                 URL: https://issues.apache.org/jira/browse/SPARK-62246
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 4.4.0
            Reporter: Luka Zdravic


Dataset.joinAsOf(..., usingColumns, ...) turns each using column into 
left(name) === right(name). So the output keeps the key column of both sides, 
and select("sym") fails with AMBIGUOUS_REFERENCE. SQL ASOF JOIN ... USING (sym) 
and a regular join(other, Seq("sym")) return one key column, placed first.

  SQL:       ASOF JOIN quotes ... USING (sym)      -> sym, tt, qty, qt, bid
  DataFrame: joinAsOf(..., usingColumns = ["sym"]) -> tt, sym, qty, qt, sym, bid

PySpark DataFrame._joinAsOf(on="sym") and Spark Connect take the same path.

Fix: build the AsOfJoin with usingColumns, as SQL does.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to