Luka Zdravic created SPARK-62245:
------------------------------------

             Summary: DataFrame as-of join drops a right row exactly at the 
tolerance when allowExactMatches is false
                 Key: SPARK-62245
                 URL: https://issues.apache.org/jira/browse/SPARK-62245
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 4.4.0
            Reporter: Luka Zdravic


Dataset.joinAsOf with a tolerance and allowExactMatches = false also makes the 
tolerance bound strict. So a right row exactly `tolerance` away from the left 
row is dropped. SQL ASOF JOIN and pandas merge_asof keep it. 
pyspark.pandas.merge_asof has the same problem.

Example: left key 5, right key 3, tolerance 2, backward, allowExactMatches = 
false.
- SQL ASOF JOIN and pandas merge_asof: match 3.
- DataFrame joinAsOf and pyspark.pandas.merge_asof: no match.

Fix: allowExactMatches changes only the match itself (> instead of >=). The 
tolerance bound stays inclusive. The code comes from SPARK-36813.




--
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