[
https://issues.apache.org/jira/browse/SPARK-62408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SPARK-62408:
-----------------------------------
Labels: pull-request-available (was: )
> Use the cursor scan for nearest ASOF joins
> ------------------------------------------
>
> Key: SPARK-62408
> URL: https://issues.apache.org/jira/browse/SPARK-62408
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 4.5.0
> Reporter: Luka Zdravic
> Priority: Minor
> Labels: pull-request-available
>
> SortMergeAsOfJoinExec reads the right side once with a cursor for backward
> and forward joins (SPARK-60744, SPARK-62247). A nearest join never takes it:
> for every left row, it reads its right-side group again from the start, up to
> the first row above the left key. So a group with N left rows and M right
> rows costs up to N x M key reads, and a large group spills to disk.
> A nearest join that allows exact matches and has no tolerance and no extra ON
> condition can take the cursor too. The cursor keeps the first right row of
> the largest key below the left key, and compares it with the first row at or
> above the left key. It picks the same row as the buffered scan: the smaller
> gap, and the row before on an equal gap. It needs no new config:
> spark.sql.join.sortMergeAsOfJoin.cursorScan.enabled turns it off.
> Measured with 2M left and 2M right rows in 1,000 groups (8-core Intel Xeon,
> JDK 21, best of 3): 14.2 s with the buffered scan, 1.41 s with the cursor.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]